help-octave
[Top][All Lists]
Advanced

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

sscanf "inconsistency" ?


From: Peter Jensen
Subject: sscanf "inconsistency" ?
Date: Wed, 20 Oct 2004 22:09:53 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910

Hi,

I am new to octave. Writing some small test programs
I found the following "inconsistency" in the sscanf
function. When numbers are extracted a column
array  is returned, however if strings are extracted
a row array is returned.  Please note that the number of
fields identified ( written to length) is correct in both cases.

Have I misunderstood something, or is sscanf
behaving is an inconsistent manner ?.

Peter
-----------------------------------------------------------

text    = "This is OK" ;
numbers = "1 2 3 4 5" ;

text
[return_string,length] = sscanf(text,"%s") ;
length
return_string
a = ["this" ; "is" ; "OK"]

numbers
[return_number,length] = sscanf(numbers,"%d") ;
length
return_number

a  = [ 6 ; 7 ; 8 ; 9 ]




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



reply via email to

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