![]() |
Matlab-输入验证
验证输入或退出程序并同时显示错误消息的好方法是什么?
例如,如果我输入 Length = input('\nEnter a length in feet: '); 如何检查数字是否大于0。 就像是 if Length > 0 then %%do code else %%Output error %%nothing to do here so it just continues and exits end [B]回答:[/B] 我用断言: assert(Length>0,'Length is less than zero, exiting.') 看[URL="http://www.mathworks.com/help/techdoc/ref/assert.html"]这里[/URL] [url=https://stackoverflow.com/questions/4919561]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 05:06。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.