matlabsize

How to know the size of a variable in MATLAB


I have variables in MATLAB, I've checked their class using class() but I also want to know the size that they take in the memory. More accurately, I know that they are of double type, and I want to make sure that they are 32-bit double and not 64-bit.

The version of the MATLAB I'm using is R2009b.


Solution

  • You can use whos to obtain an array of structures that describe, amongst other things, the size in bytes of each variable.

    Note that a double is, by definition, 64-bit!