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) ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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; }
回答2:
MATLAB uses JIDE, which is built on Java/Swing for their user interface. Embeddable figures have not been available for MATLAB Builder JA as well. Therefore I think, according to stijn, there are no embeddable plots. I would love to be proven wrong.