Enumerated Data Type in MATLAB
3 次查看(过去 30 天)
显示 更早的评论
I want to define a enumerated data type (eMatType) which consists of the following definitions :
STEEL = 1
CONCRETE = 2
ALUMINUM = 3
Now, once that data type is created, how can I use it to declare a variable. eg. if I want to delclare a variable as 'double', I use x = zeros(1,1,'double')
How can I declare a variable with the new enumerated data type?
Thanks.
0 个评论
采纳的回答
Fangjun Jiang
2011-6-17
Check out the MATLAB Enumeration class. http://www.mathworks.com/support/2010b/matlab/7.11/demos/enumerations-in-r2010b.html
0 个评论
更多回答(1 个)
Laura Proctor
2011-6-17
Do you mean something like this?
x = nominal([3:-1:1,1,1,3],{'Steel','Concrete','Aluminum'})
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!