help-octave
[Top][All Lists]
Advanced

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

Re: Help in porting a toolbox


From: Jordi Gutiérrez Hermoso
Subject: Re: Help in porting a toolbox
Date: Thu, 24 May 2012 16:10:09 -0400

On 24 May 2012 15:43, Mathieu Dubois <address@hidden> wrote:

> I wanted to port the SOM toolbox (see:
> http://www.cis.hut.fi/somtoolbox/) to Octave.
[snip]
> I have some problems with code involving (s)scanf. I have read that there are 
> a lot of differences between Octave and Matlab in this area.
> The problematic line can be found in som_read_data.m, line 225:
>  [s, c, e, n] = sscanf(li, '%s%[^ \t]');
> The goal of the line is to read the header of a file which contains the data 
> label.
> The variable li (the line) contains "SepalL SepalW PetalL PetalW".
> Under Matlab, s contains "SepalL" (the first label) and the variable n (which 
> causes the error) contains 8.
> Under Octave, s contains the correct value but n is 0.

What Octave version? I just tried this example but got n = 6, not 0.

> Is there a way to know you're under octave (something like a
> ISOCTAVE variable)? That would be a simple way to write conditionnal
> code like

> if exists('ISOCTAVE')
>  % Octave specific code
> else
>  % Matlab specific code
> end

If you need to do this, then you have almost surely found an Octave
bug. Please report it:

    http://www.gnu.org/software/octave/bugs.html

However, if you need to work around the bug, you can check

    if (exist OCTAVE_VERSION)

- Jordi G. H.


reply via email to

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