Hi I'm trying to make a GUI to control a model on a RTW ,I made the GUI with GUIDE and set the strartfcn of the model to "localAddEventListener" , the model and GUI works perfectly on simulation but when I build it on XPC target box and try to press connect it gives me an error saying that it can't find the function "localAddEventListener"
can you please help me with that
Hi!i'm italian and I hope I'm not wrong to write.First of all I want to thank you for this example.
I copied the functions localLoadModel = (modelName), localRemoveEventListener, localEventListener (block, evendata), modelLoaded=modelIsLoaded(modelName), localAddEventListener in my M-File , and the callback functin for the start button (Untitled_8 in my M-file) and stop button (Untitled_9 in my M-file)....but i have created my gui from GUIDE so i have copied this code in the Opening_Fcn:
modelName='ok_prova_esf1';
% Load the simulink model
ad = localLoadModel(modelName);
% Put an empty line on the axes for each signal that will be
% monitored
% Save the line handles, which will be useful to have in an
% array during the graphics updating routine.
nlines = length(ad.viewing);
hl = nan(1,nlines);
colourOrder = get(handles.axes2,'ColorOrder');
for idx = 1:nlines
hl(idx) = line('Parent',handles.axes2,...
'XData',[],...
'YData',[],...
'Color',colourOrder(mod(idx-1,size(colourOrder,1))+1,:),...
'EraseMode','xor',...
'Tag',sprintf('signalLine%d',idx));
end
ad.lineHandles = hl;
% For the UI to be closed there needs to be a modelName field in
% appdata so just create a dummy one
ad.modelName = modelName;
% Create the handles structure
ad.handles = guihandles(handles.figure1);
% Save the application data
guidata(handles.figure1,ad);
% Position the UI in the centre of the screen
movegui(handles.figure1,'center')
% Make the UI visible
set(handles.figure1,'Visible','on');
handles.output = hObject; %aggiunge un nuovo elemento alla struttura
%della GUI,assegnando il valore dell'hObject
% Salva la struttura handles
guidata(hObject, handles);
Matlab give me this error:
??? Reference to non-existent field 'lineHandles'.
Error in ==> oscilloscopio2>Untitled_8_Callback at 391
for idx = 1:length(ad.lineHandles)
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> oscilloscopio2 at 20
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)oscilloscopio2('Untitled_8_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
and
??? Reference to non-existent field 'eventHandle'.
Error in ==> oscilloscopio2>localRemoveEventListener at 792
for idx = 1:length(ad.eventHandle)
Error in ==> oscilloscopio2>Untitled_9_Callback at 417
localRemoveEventListener;
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> oscilloscopio2 at 20
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)oscilloscopio2('Untitled_9_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
can you help me,please??
Comment only