[Scilab-users] text file reading with fixed width field separated by space character

Antoine Monmayrant amonmayr at laas.fr
Tue Apr 23 18:39:49 CEST 2013


Hi,

I don't have a 100% scilab solution but I have a workaround for you: why don't you "clean" your file format before opening it with readcsv?
If you are under linux, you can use 'sed' or 'tr' to replace every occurrence of '  ' by ' ' (ie 2 whites spaces by only 1).
That is usually what I do to interface the output of my other softs with scilab.

Antoine


Le Mardi 23 Avril 2013 17.56 CEST, David Chèze <david.cheze at cea.fr> a écrit: 
 
> Hi, I was confusing dot and space in my previous post... the issue is with
> space character as separator.
> 
> I'm trying to read a text files generated by another ("old") program which i
> can't modify or configure: fields are separated by 2 spaces and one of the
> space can be replaced by a negative sign mark - thus keeping the filed's
> width constant.
> There's an issue when importing data into scilab thanks to the function
> powerful csvRead function : it interprets the 2 consecutive spaces as 2
> different fields thus it expects that this is the case along the whole file:
> and it is not the case as soon you have a negative value (see attached
> file).issue-readCsv.txt
> 
> I know that the text file format is not very reliable but it is what i have
> : do you have any workaround using csvRead function as it is?
> 
> 
> Thanks,
> 
> David 
> 
> 
> 
> --
> View this message in context: http://mailinglists.scilab.org/text-file-reading-with-fixed-width-field-separated-by-space-character-tp4026583p4026584.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
 
 
 
 




More information about the users mailing list