我正在做一个滑块曲柄机构的模型,我想在曲柄的长度超过滑块臂的时候显示一个错误.随着曲柄的长度r2和滑块的长度一样r3,我的代码是这样的:
if r3=<r2
error('The crank's length cannot exceed that of the slider')
end
Run Code Online (Sandbox Code Playgroud)
我收到错误:
??? error('The crank's length cannot exceed that of the slider')
|
Error: Unexpected MATLAB expression.
Run Code Online (Sandbox Code Playgroud)
谁能告诉我我做错了什么以及如何解决它?
gno*_*ice 12
如果要'在字符串中使用该字符,则必须在其前面加上另一个字符'(请注意文档中的示例):
if (r3 <= r2)
error('The crank''s length cannot exceed that of the slider');
end
Run Code Online (Sandbox Code Playgroud)
此外,请注意我从所做的更改=<来<=.