在GUI中如何修改Simulink的仿真结束时间
通过在GUI界面里的edit text输入数据,来改变simulink里的参数。load_system('gen');
x=str2double(get(hObject,'String'));
set_param('gen/Constant','Constant','x');
改不了,怎么回事啊?
load_system('gen');
st=str2num(get(hObject,'String'));
set_param('gen','StopTime','st');
会把仿真时间改成变量st,然后sim('gen')就会报错,
??? Error using ==> sim
Error evaluating expression 'st' for 'Stop time' specified in the Configuration Parameters dialog for
block diagram 'gen': Error using ==> sim
Undefined function or variable 'st'.
Error in ==> gen_zong>pushbutton1_Callback at 258
sim('gen.mdl');
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> gen_zong at 42
gui_mainfcn(gui_State, varargin{:});
??? Error while evaluating uicontrol Callback
谁能回答下???
另外,edit text怎么enable啊?不能输入,显示灰色的那种。
页:
[1]