m code transformed into c code accounterd errors

8 views (last 30 days)
hey boys,even i've learned matlab long,but when i first got something about 'm code transformed into c code',i just felt confused as follows.
??? The function failed to compile, if you intended to compile the file use %#eml directive in 'C:/Users/LenovoUser/Desktop/graduate/GUIS_FEX/GUI_1.m', however if you wish to call out to matlab use eml.extrinsic('GUI_1') before calling the function.
function [] = GUI_1() % Demonstrate how to delete an entry from a uicontrol string. % Creates a listbox with some strings in it and a pushbutton. When user % pushes the pushbutton, the selected entry in the listbox will be deleted. % % Suggested exercise: Modify the GUI so when the user deletes a certain % string, the 'value' property is set to the previous string instead of to % the first string. % % % Author: Matt Fig % Date: 7/15/2009
S.fh = figure('units','pixels',... 'position',[500 500 200 260],... 'menubar','none',... 'name','GUI_1',... 'numbertitle','off',... 'resize','off');
S.ls = uicontrol('style','list',... 'unit','pix',... 'position',[10 60 180 180],... 'min',0,'max',2,... 'fontsize',14,... 'string',{'one';'two';'three';'four'}); S.pb = uicontrol('style','push',... 'units','pix',... 'position',[10 10 180 40],... 'fontsize',14,... 'string','Delete String',... 'callback',{@ed_call,S}); %fontsize
function [] = ed_call(varargin) % Callback for pushbutton, adds new string from edit box. S = varargin{3}; % Get the structure. L = get(S.ls,{'string','value'}); % Get the users choice.
% We need to make sure we don't try to assign an empty string. if ~isempty(L{1}) L{1}(L{2}(:)) = []; % Delete the selected strings. set(S.ls,'string',L{1},'val',1) % Set the new string. end
i just have no idea about why this situation would appear.Would you help me solve it or give me some explanation.Your advices would be appreciated so much.Thx~

Answers (1)

Mike Hosea
Mike Hosea on 28 Sep 2012
I am a little confused. From the way you ask the question, we would think that that you were just using MATLAB normally and this error popped up unexpectedly. However, my best guess is that you dropped some code written by Matt Fig into a Simulink Embedded MATLAB Block, or you tried to compile it by using the emlc command in MATLAB. Perhaps you were trying to compile something that you wrote that in turn calls this GUI-related code. At any rate, if you are trying to compile some thing, you will need to understand how to use extrinsic functions. Extrinsic function calls are calls from generated C code back into MATLAB at run-time.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!