How to get 'type' of a variable in matlab?
7,040 次查看(过去 30 天)
显示 更早的评论
Hi, We declare many types of variables in matlab such as double, string, symbolic etc. How to get type of a variable?
0 个评论
采纳的回答
Sean de Wolski
2013-11-15
编辑:MathWorks Support Team
2018-11-27
x = 100;
class(x)
tf = isa(x,'double')
0 个评论
更多回答(1 个)
Azzi Abdelmalek
2013-11-15
class(your_variable)
9 个评论
ANTONIO RUBIA
2021-3-8
Dear Steven, thank you for your constructive and useful answer. My plan is to use that information in an app environment similar to the Import Data functionality of the Econometric Modeler app. The point is to allow the user to import data from the workspace into the main app by selecting the variables listed on a table by rows, with columns showing different information (name, class, size, etc.).
The function whos you suggested does the job. In my case, something like:
info = evalin('base', 'whos')
collects all the information meant to be reported in the selection table and can be processed programatically in a function. Your suggestion should help clarify M. Sivakumar's earlier question too.
This is already a valid solution, but in case you may have better /safer alternatives, I would definitively love to know more about them.
Thanks !
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!