Date: Feb 14, 2013 10:22 AM
Author: Steven Lord
Subject: Re: Memory leak in num2str(integer Array, '%d')



"Andrew " <Andrew.Trapani@saabsensis.com> wrote in message
news:kfhi83$j5v$1@newscl01ah.mathworks.com...

*snip*

> But the size is exactly twice what I expected, since I thought char was 1
> byte, but it is apparently two bytes.
> 14984304 bytes * 2 = 29968608 bytes
> 29968608 bytes * 2 = 59937216 Bytes


C = 'a';
whos C

shows that the each element stored in an array of char data is 2 bytes long,
not 1.

http://www.mathworks.com/help/matlab/matlab_external/matlab-data.html#f22000

"MATLAB strings are of type char and are stored the same way as unsigned
16-bit integers except there is no imaginary data component. Unlike C,
MATLAB strings are not null terminated."

*snip*

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com