[scilab-Users] re-delimiting data

Peng Du eddy.pdu at gmail.com
Thu Jun 16 18:58:26 CEST 2011


Thanks Adrien,

The thing confuses me is that the method I used works fine with the
un-processed raw data but fails with the processed file which has
basically the same structure.

And how can I loop through the file if I use the fscanfMat?

Regards,

Peng

On 16 June 2011 17:28, Adrien Vogt-Schilb <vogt at centre-cired.fr> wrote:
> Hi
>
>
> as far as i know, you cannot use a syntaxe like
>
> [a(1) a(2)] = f(b,c,d,e)
>
> in scilab
>
> a workaround could be
>
> [a1 a2] = f(b,c,d,e)
> a = [a1 a2]
>
>
> in your case, i believe you could use something more direct, like :
>
> val = fscanfMat(fid )
>
> BR,
> AVS
>
>
> On 16/06/2011 18:18, Peng Du wrote:
>
> Hi everyone,
>
> I collected some raw data which looks like:
>
> -112 -100 -95 -91 -114 -112 -95 -90 -112 -112 -113 -107 -100 -109 -111 -106
> -70 -98 -95 -111 -114 -114 -113 -111 -113 -103 -112 -109 -111 -112 -114 -112
> ...
>
> -64 -57 -57 -112 -110 -93 -84 -86 -105 -98 -107 -99 -94 -113 -113 -115
> -64 -55 -88 -113 -82 -83 -85 -88 -100 -114 -113 -99 -91 -109 -113 -110
>
> So there are 16 columns per line.
>
> I wrote a c++ program to do some calculation on the raw data and
> reproduce a file with similar format which looks like:
>
> -112 -100 -95 -91 -114 -112 -95 -90 -112 -112 -113 -107 -100 -109 -111 -106
> -91 -99 -95 -101 -114 -113 -104 -100 -112 -108 -112 -108 -106 -110 -112 -109
> -91 -97.3 -98.7 -105 -113 -113 -107 -96.7 -112 -109 -109 -102 -102
> -111 -111 -109
>
> Then I tried to read the file in Scilab using:
>
> [num_read, val(1), val(2), val(3), val(4), val(5), val(6), val(7),
> val(8),val(9), val(10), val(11), val(12), val(13), val(14), val(15),
> val(16)] = mfscanf(fid, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d
> %d");
>
> However the raw data work ok, but with the process data file Scilab
> always reports "invalid index error". Why this is happening?
>
> Thanks very much.
>
> Regards,
>



More information about the users mailing list