Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Memory leak in num2str(integer Array, '%d')
Replies: 4   Last Post: Feb 14, 2013 2:04 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,945
Registered: 12/7/04
Re: Memory leak in num2str(integer Array, '%d')
Posted: Feb 14, 2013 10:22 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Andrew " <Andrew.Trapani@saabsensis.com> wrote in message


> 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.


"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."


Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.