|
I tried to use the set_param command, but I get another error:
??? Error using ==> Inflating_Test_Panel>start_pushbutton_Callback at 76
Cannot perform command line simulation of 'Inflating_Test_Model6' in external
mode.
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> Inflating_Test_Panel at 16
gui_mainfcn(gui_State, varargin{:});
Error in ==>
guidemfile>@(hObject,eventdata)Inflating_Test_Panel('start_pushbutton_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
Seems model cannot go on external mode, but in Simulink works perfectly.
This is the m.file of the GUI, I'm stunned :(
function varargout = Inflating_Test_Panel(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Inflating_Test_Panel_OpeningFcn, ...
'gui_OutputFcn', @Inflating_Test_Panel_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
function Inflating_Test_Panel_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
function varargout = Inflating_Test_Panel_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function input_mp_Callback(hObject, eventdata, handles)
input = str2num(get(hObject,'String'));
if (isempty(input))
set(hObject,'String','0')
end
guidata(hObject, handles);
function input_mp_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function start_pushbutton_Callback(hObject, eventdata, handles)
options = simset('SrcWorkspace','current');
sim('Inflating_Test_Model6',[],options);
set_param('Inflating_Test_Model6', 'SimulationMode', 'external');
set_param(gcs,'SimulationCommand','connect');
set_param(gcs,'SimulationCommand','start');
set_param('Inflating_Test_Model6','max_pressure',num2str(mp));
|