octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: num2str help


From: Julien Bect
Subject: Re: num2str help
Date: Fri, 15 May 2015 07:26:21 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

Le 15/05/2015 06:21, rik a écrit :
5/14/15

Can someone verify what the following two code pieces do in Matlab?  In
Octave, num2str operates along rows first, while sprintf operates along
columns first.  Maybe that inconsistency is required for compatibility, but
it is odd.

-- Begin Code --
x = num2str (magic (3), '%d\n')
size (x)

y = sprintf ('%d\n', magic (3))
size (y)
-- End Code --

>> x = num2str (magic (3), '%d\n')
size (x)

x =

8
1
6
3
5
7
4
9
2


ans =

     3     5

>> y = sprintf ('%d\n', magic (3))
size (y)

y =

8
3
4
1
5
9
6
7
2



ans =

     1    18


>> version

ans =

7.14.0.739 (R2012a)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]