Does MATLAB have the equivalent of the C/C++ 'sizeof' function?
I have some code that can run on many numeric types, and I need to be able to calculate the number of bytes per element in a given numeric array, let's call it 'A'
bytesPerElement = sizeof(class(A));
I suppose I could do something like:
w = whos(A);
bytesPerElement = w.bytes / numel(A);
but I would be surprised if there was not a function that calculates the number of bytes per element directly from the variable class. I just can't seem to find that function ... entering the wrong words into the search engine, I suppose.