how to set a unit to variable?
古いコメントを表示
I encounter the error after run this :
30*unit::mm
2 件のコメント
Devarshi Patel
2020 年 4 月 19 日
Check below link if you have version greater than or equal to R2017A
Walter Roberson
2020 年 4 月 20 日
Discussion of character strings is not very relevant to the question of whether MATLAB can handle units.
採用された回答
その他の回答 (2 件)
the cyclist
2015 年 12 月 27 日
1 投票
In general, MATLAB variables do not have units, and what you have written is not a valid MATLAB syntax (to my knowledge).
There is a contribution to the File Exchange that allows for assigning unit to variables: http://www.mathworks.com/matlabcentral/fileexchange/29621-units-conversion-toolbox/content/UnitConversion-rev2/html/defining.html.
1 件のコメント
Karan Gill
2017 年 4 月 7 日
編集済み: Karan Gill
2017 年 4 月 7 日
Units are now in MATLAB if you have Symbolic Math Toolbox. See the tutorial: https://www.mathworks.com/help/symbolic/units-of-measurement-tutorial.html
Posted a separate answer below so that OP can accept.
Steven Lord
2015 年 12 月 27 日
0 投票
That syntax is specifically for use in the MuPAD Notebook Interface (as stated by the note at the top of this documentation page) not in MATLAB.
3 件のコメント
fred bnm
2015 年 12 月 29 日
Walter Roberson
2015 年 12 月 29 日
You should consider instead using (at the MATLAB level)
30 * sym('unit::mm')
Walter Roberson
2020 年 10 月 13 日
30 * sym('unit::mm')
is no longer supported. These days you should use symunit . Or if you are despairate,
30 * feval(symengine, 'unit::mm')
カテゴリ
ヘルプ センター および File Exchange で Functional Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!