Generating C code from MATLAB GUI
6 次查看(过去 30 天)
显示 更早的评论
hello,
here is my problem, I created a GUI with GUIDE, I then exported in .m, and when I want generated C++ code from Matlab Coder I m obtien an error:
Error:
Code >>-build test.prj
??? This kind of speech is not supported
My code:
h6 = uicontrol(...
'Parent',h5,...
'Units','characters',...
'BackgroundColor',get(0,'defaultuicontrolBackgroundColor'),...
'Callback',@(hObject,eventdata)interfasetest_export3('pushbutton1_Callback',hObject,eventdata,guidata(hObject)),...
'Position',[3.66666666666667 2 25.1666666666667 2.41666666666667],...
'String','Ouvrir fichier .AVI',...
'Tag','pushbutton1',...
'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
Matlab Coder do not know the syntax with the @:
@(hObject,eventdata)interfasetest_export3('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Thank you for your help and I'm sorry for my english, I'm french.
回答(1 个)
Ryan Livingston
2013-1-23
Hi Matthieu,
Unfortunately MATLAB Coder does not support using anonymous functions like:
@(hObject,eventdata)interfasetest_export3('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Moreover, gui code generation is not supported. If your intention is to share the GUI functionality or deploy it to other users without needing MATLAB then MATLAB Compiler may allow you to do this.
Using MATLAB Compiler you can essentially wrap up your application into an executable or library which can then be called from C/C++ or various other targets using the Builder products. This can then be distributed to others along with a set of runtime libraries called the MCR and used without MATLAB.
Here is a small example of using MATLAB Compiler:
~Ryan
2 个评论
Walter Roberson
2013-1-28
In that case, you will need to write your own graphics functions. MATLAB Coder is not able to generate any graphics code.
You can avoid using anonymous functions using one of the techniques described at http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.3F
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!