Matlab直接绘制在c ++ GUI中 [英] Matlab plots directly inside c++ GUI
本文介绍了Matlab直接绘制在c ++ GUI中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用matlab编译器从我的m文件生成c ++共享库。
是否可以直接在c ++ GUI(而不是单独的窗口)中显示matlab图?
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) ?
推荐答案
容易解决。如果你正在使用windows,你可以只是设置matlab窗口。
这样的东西。
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;
}
这篇关于Matlab直接绘制在c ++ GUI中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文