Rank: 229803 based on 0 downloads (last 30 days) and 0 file submitted
photo

ikariam88

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by ikariam88
Updated File Comments Rating
13 Apr 2012 Simulink Signal Viewing using Event Listeners and a MATLAB UI. This demo shows how to use block listeners to view model signals in a MATLAB user interface. Author: Phil Goddard

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??

Contact us