Matlab – How to get the type of a variable in MATLAB

MATLABtypesvariables

Does MATLAB have a function/operator that indicates the type of a variable (similar to the typeof operator in JavaScript)?

Best Answer

Use the class function:

>> b = 2
b =
     2
>> a = 'Hi'
a =
Hi
>> class(b)
ans =
double
>> class(a)
ans =
char