how to set a unit to variable?
Mostrar comentarios más antiguos
I encounter the error after run this :
30*unit::mm
2 comentarios
Devarshi Patel
el 19 de Abr. de 2020
Check below link if you have version greater than or equal to R2017A
Walter Roberson
el 20 de Abr. de 2020
Discussion of character strings is not very relevant to the question of whether MATLAB can handle units.
Respuesta aceptada
Más respuestas (2)
the cyclist
el 27 de Dic. de 2015
1 voto
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 comentario
Karan Gill
el 7 de Abr. de 2017
Editada: Karan Gill
el 7 de Abr. de 2017
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
el 27 de Dic. de 2015
0 votos
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 comentarios
fred bnm
el 29 de Dic. de 2015
Walter Roberson
el 29 de Dic. de 2015
You should consider instead using (at the MATLAB level)
30 * sym('unit::mm')
Walter Roberson
el 13 de Oct. de 2020
30 * sym('unit::mm')
is no longer supported. These days you should use symunit . Or if you are despairate,
30 * feval(symengine, 'unit::mm')
Categorías
Más información sobre Functional Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!