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 ]
Bruno Luong

Posts: 8,805
Registered: 7/26/08
Re: Memory leak in num2str(integer Array, '%d')
Posted: Feb 14, 2013 2:04 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Andrew" wrote in message <kfjc2c$67c$1@newscl01ah.mathworks.com>...
> I should also note the reason I wanted to use the format option, it was A LOT faster:
> >> d=repmat(int8(10),624346,1);
> >> tic;f=num2str(d);toc

> Elapsed time is 11.023761 seconds.
> >> tic;h=num2str(d,'%d');toc
> Elapsed time is 0.861489 seconds.

If you want speed, use sprintf instead. NUM2STR has a lot of overhead.

sprintf('%d\n',d);

Bruno



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.