Matlab 获取simulink中的stop time

stop_time_as_str = get_param(gcs, 'StopTime'); 
t= str2double(stop_time_as_str); 
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
MatlabGUI里面启动或者暂停Simulink模型-sysstop_new.m 针对这个问题:https://www.ilovematlab.cn/thread-23233-1-1.html 现在我做一个集解答,从mathworks那里学习了一下。 第一步:创建你自己的Simulink模型,这个不用我讲吧,我们使用以下模型做演示: start_and_stop.mdl 第二步:创建自己的GUI, 这个论坛里也有例子,我们使用以下文件。 start_and_stop_gui.fig start_and_stop_gui.m Figure12.jpg 在start simulation里面,直接用sim函数,这个大家好像都会: % --- Executes on button press in startsim. function startsim_Callback % hObject handle to startsim % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data modelname = get; stoptime = str2num); sim复制代码 在stop simulation,里面,callback这样写: % --- Executes on button press in stopsim. function stopsim_Callback % hObject handle to stopsim % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data global GUIStopFlag; GUIStopFlag = 1; 复制代码第三步:写一个s函数,不停地检测这个GUIStopFlag参数,发送命令给STOP按钮,告诉他,可以结束了,简单吧? sysstop_new.m 第四步:在simulink模型里面,加上这个S函数 Figure13.jpg 好了,大功告成了,现在你就可以在GUI里随意控制Simulink模型了。 注:文所用的模型,GUI文件,由mathworks公司提供。
MatlabGUI里面启动或者暂停Simulink模型-start_and_stop_gui.fig 针对这个问题:https://www.ilovematlab.cn/thread-23233-1-1.html 现在我做一个集解答,从mathworks那里学习了一下。 第一步:创建你自己的Simulink模型,这个不用我讲吧,我们使用以下模型做演示: start_and_stop.mdl 第二步:创建自己的GUI, 这个论坛里也有例子,我们使用以下文件。 start_and_stop_gui.fig start_and_stop_gui.m Figure12.jpg 在start simulation里面,直接用sim函数,这个大家好像都会: % --- Executes on button press in startsim. function startsim_Callback % hObject handle to startsim % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data modelname = get; stoptime = str2num); sim复制代码 在stop simulation,里面,callback这样写: % --- Executes on button press in stopsim. function stopsim_Callback % hObject handle to stopsim % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data global GUIStopFlag; GUIStopFlag = 1; 复制代码第三步:写一个s函数,不停地检测这个GUIStopFlag参数,发送命令给STOP按钮,告诉他,可以结束了,简单吧? sysstop_new.m 第四步:在simulink模型里面,加上这个S函数 Figure13.jpg 好了,大功告成了,现在你就可以在GUI里随意控制Simulink模型了。 注:文所用的模型,GUI文件,由mathworks公司提供。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一步倾川

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值