How to get the type of a variable in MATLAB October 18, 2022 by Tarik Use the class function: >> b = 2 b = 2 >> a="Hi" a = Hi >> class(b) ans = double >> class(a) ans = char