[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sscanf "inconsistency" ?
From: |
Henry F. Mollet |
Subject: |
Re: sscanf "inconsistency" ? |
Date: |
Wed, 20 Oct 2004 15:19:42 -0700 |
User-agent: |
Microsoft-Entourage/10.1.1.2418 |
I'm getting something slightly different. Not sure if it helps.
Henry
octave:37> text = "This is OK" ;
octave:38> numbers = "1 2 3 4 5" ;
octave:39> [return_string,length] = sscanf(text,"%s") ;
octave:40> length
length = 3
octave:41> return_string
return_string = ThisisOK
octave:43> [return_number,length] = sscanf(numbers,"%d") ;
octave:44> length
length = 5
octave:45> return_number
return_number =
1
2
3
4
5
on 10/20/04 2:09 PM, Peter Jensen at address@hidden wrote:
> 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
> -------------------------------------------------------------
>
-------------------------------------------------------------
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
-------------------------------------------------------------