[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: num2str() question
From: |
Geordie McBain |
Subject: |
Re: num2str() question |
Date: |
Fri, 26 Sep 2003 13:24:42 +1000 |
Use sprintf() instead; e.g.
octave> r = 10000; sprintf("%d", r)
ans = 10000
See in the manual under "Strings/Creating Strings/num2str" and "Input
and Output/C-Style I/O Functions/Formatted Output/sprintf" for more
information.
>Hi. Sorry if this is a FAQ, but I'm having trouble using num2str().
>For instance, look at this.
>
>octave:16> r = 1; num2str(r)
>ans = 1
>octave:17> r = 10; num2str(r)
>ans = 10
>octave:18> r = 100; num2str(r)
>ans = 100
>octave:19> r = 1000; num2str(r)
>ans = 1000
>octave:20> r = 10000; num2str(r)
>ans = 1e+04
>
>Why doesn't num2str() return 10000 instead of 1e+04 in the last
>instance? And how do I make it return 10000?
>
>Thanks.
>---John.
>
>
>
>-------------------------------------------------------------
>Octave is freely available under the terms of the GNU GPL.
>
>Octave's home on the web: http://www.octave.org
>How to fund new projects: http://www.octave.org/funding.html
>Subscription information: http://www.octave.org/archive.html
>-------------------------------------------------------------
>
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------