Matlab plots directly inside c++ GUI
c++, matlab, user-interface
Solution
I found easy solution. If you are using windows you could just setparent to matlab window. something like this.
HWND h = FindWindow(L"SunAwtFrame", L"Figure 1");
void MatlabViewerHack::EmbedMatlabPlot(HWND h)
{
SetWindowPos(h,NULL,rect.left(), rect.top(), rect.width(), rect.height(),0);
SetWindowLong(h, GWL_STYLE,WS_CHILD|WS_VISIBLE);
SetParent(h, parent_widget); //dynamic_cast<QWidget*>(parent())->winId()
//updating ui_state, windows xp, window 7
SendMessage(h, WM_UPDATEUISTATE, UIS_INITIALIZE, 0);
SendMessage(parent_widget, WM_UPDATEUISTATE, UIS_INITIALIZE, 0);
SendMessage(h, WM_CHANGEUISTATE, UIS_INITIALIZE, 0);
SendMessage(parent_widget, WM_CHANGEUISTATE, UIS_INITIALIZE, 0);
current_window = h;
}
Problem
I'm using matlab compiler to generate c++ shared library from my m files. Is it possible to display matlab plots directly inside c++ GUI (not in a separate window) ?