octave-maintainers
[Top][All Lists]
Advanced

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

Re: sprintf help


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

Le 15/05/2015 06:53, rik a écrit :
Could someone run the following code under Matlab?

-- Begin Code --
x = sprintf ('%s%s%s\n', [65 66 67])
size (x)

y = sprintf ('%s %s%s\n', [65 66 67])
size (y)
-- End Code --

Octave returns 1x3, i.e., missing the newline character.  Unless there is
something after the first '%s' in the format specification such as a space.

>> x = sprintf ('%s%s%s\n', [65 66 67])
size (x)

x =

ABC


ans =

     1     3

>> y = sprintf ('%s %s%s\n', [65 66 67])
size (y)

y =

ABC


ans =

     1     4

>> version

ans =

7.14.0.739 (R2012a)




reply via email to

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