Matlab plots directly inside c++ GUI

匿名 (未验证) 提交于 2019-12-03 07:50:05

问题:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!