Hello Everybody!
I have created a stand alone exe from simulink model. And now i want to control it by GUI. Everything is working fine, i.e the mat file myrtp.mat has all the required parameters and when i tried to run my model as described in ''help rsimgetrtp'' from command prompt it works fine. And when i tried to use the same methodology in the call back function of GUI pushbutton, i am not getting any error but progress bar shows BUSY for sometime and then nothing happens. here is the pushbutton call back code. Can any one tell me what's missing here:
function pushbuttonModel_Callback(hObject, eventdata, handles)
% hObject handle to pushbuttonModel (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if ~isdeployed
depath=which('Data_Test.xls');
else
depath=[ctfroot,'\Matlab Work\maabhen\Data_Test.xls'];
end
Inputs;
if ~isdeployed
npa=which('myrtp.mat');
cd (fileparts(npa))
load myrtp.mat
else
load ([ctfroot,'\Matlab Work\maabhen\myrtp.mat'])
if ~isdeployed
save myrtp.mat rtp;
exeloc='ADM3.exe';
runstr = ['!',exeloc,' ','-p',' ',['G:\Master Thesis\Matlab Work\maabhen\myrtp.mat'],' ',...
'-f',' ','input.mat=input.mat',' ','-f',' ','flowrate.mat=flowrate.mat',...
' ','-tf',' ',24];
else
%curd=pwd;
cd([ctfroot,'G:\Master Thesis\Matlab Work\maabhen\rtw\'])
save ('myrtp.mat', 'rtp');
exeloc='ADM3.exe';
runstr=['!',exeloc,' ','-p',' ','myrtp.mat',...
' ','-f',' ','input.mat=input.mat',' ','-f',' ','flowrate.mat=flowrate.mat',...
' ','-tf',' ',num2str(Sim_Time)];
%cd(curd)
s=[];
end
load ([ctfroot,'G:\Master Thesis\Matlab Work\maabhen\ADM3.mat'])
end
|
|
0
|
|
|
|
Reply
|
Zia
|
5/7/2010 9:01:04 AM |
|
"Zia " <ziagemini@hotmail.com> wrote in message <hs0ksg$fe6$1@fred.mathworks.com>...
> Hello Everybody!
>
> I have created a stand alone exe from simulink model. And now i want to control it by GUI. Everything is working fine, i.e the mat file myrtp.mat has all the required parameters and when i tried to run my model as described in ''help rsimgetrtp'' from command prompt it works fine. And when i tried to use the same methodology in the call back function of GUI pushbutton, i am not getting any error but progress bar shows BUSY for sometime and then nothing happens. here is the pushbutton call back code. Can any one tell me what's missing here:
>
> function pushbuttonModel_Callback(hObject, eventdata, handles)
> % hObject handle to pushbuttonModel (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)
>
> if ~isdeployed
> depath=which('Data_Test.xls');
> else
> depath=[ctfroot,'\Matlab Work\maabhen\Data_Test.xls'];
> end
>
> Inputs;
> if ~isdeployed
> npa=which('myrtp.mat');
> cd (fileparts(npa))
> load myrtp.mat
> else
> load ([ctfroot,'\Matlab Work\maabhen\myrtp.mat'])
>
>
> if ~isdeployed
> save myrtp.mat rtp;
> exeloc='ADM3.exe';
> runstr = ['!',exeloc,' ','-p',' ',['G:\Master Thesis\Matlab Work\maabhen\myrtp.mat'],' ',...
> '-f',' ','input.mat=input.mat',' ','-f',' ','flowrate.mat=flowrate.mat',...
> ' ','-tf',' ',24];
> else
> %curd=pwd;
> cd([ctfroot,'G:\Master Thesis\Matlab Work\maabhen\rtw\'])
> save ('myrtp.mat', 'rtp');
> exeloc='ADM3.exe';
> runstr=['!',exeloc,' ','-p',' ','myrtp.mat',...
> ' ','-f',' ','input.mat=input.mat',' ','-f',' ','flowrate.mat=flowrate.mat',...
> ' ','-tf',' ',num2str(Sim_Time)];
> %cd(curd)
> s=[];
> end
> load ([ctfroot,'G:\Master Thesis\Matlab Work\maabhen\ADM3.mat'])
> end
a hint:
- put a KEYBOARD statement at the beginning of your callback function...
- call it...
- the editor opens the file at the KEYBOARD statement...
- once you're in debug mode, see what happens if you walk through your
function, eg, examine variables, the flow,etc,...
us
|
|
0
|
|
|
|
Reply
|
us
|
5/7/2010 9:12:05 AM
|
|
Ok i know where is the problem now:
if ~isdeployed
npa=which('myrtp.mat');
cd (fileparts(npa))
load myrtp.mat;
else
load ([ctfroot,'\Matlab Work\maabhen\myrtp.mat'])
end
ind=rtp.parameters.map(1).ValueIndices;
ind2=rtp.parameters.map(2).ValueIndices;
ind3=rtp.parameters.map(3).ValueIndices;
rtp.parameters.values(1,ind(1):ind(2))=DIM_D;
rtp.parameters.values(1,ind2(1):ind2(2))=DIGESTERPAR;
rtp.parameters.values(1,ind3(1):ind3(2))=DIGESTERINIT;
if ~isdeployed
save myrtp.mat rtp;
this is to read in new parameters and save it to old myrtp.mat. but now i am having the following error:
??? Error using ==> save
Variable 'rtp' not found.
Error in ==> MT>pushbuttonModel_Callback at 109
save myrtp.mat rtp;
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> MT at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
guidemfile>@(hObject,eventdata)MT('pushbuttonModel_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
Am i doing it the wrong way??? Any help would be appreciated.
|
|
0
|
|
|
|
Reply
|
Zia
|
5/7/2010 10:54:04 AM
|
|
|
2 Replies
131 Views
(page loaded in 0.031 seconds)
|