[scilab-Users] re-delimiting data
Adrien Vogt-Schilb
vogt at centre-cired.fr
Thu Jun 16 19:06:58 CEST 2011
Hi
Actually, i was wrong when I said that
[a(1) a(2)] = f(b,c,d,e)
is illegal syntax in scilab.
In that case, the problem may come from the format of your processed data table.
Do you know which separators (spaces? tabs?) are used in the raw and in the processed data table? If not, can you join the raw and processed tables?
And, again, are you sure that it will not be preferable to read the whole matrix at once? try this:
help read_csv
On 16/06/2011 18:58, Peng Du wrote:
> 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,
>>
--
*Adrien Vogt-Schilb*
Research Fellow
vogt at centre-cired.fr <mailto:vogt at centre-cired.fr>
Tel: (+33) 1 43 94 73 96
Fax: (+33) 1 43 94 73 70
CIRED
45 bis, Av de la Belle Gabrielle
F-94736 Nogent-sur-Marne
http://www.centre-cired.fr/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20110616/c365ba30/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logocired.png
Type: image/png
Size: 4092 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20110616/c365ba30/attachment.png>
More information about the users
mailing list