[scilab-Users] 500mo Ascii file
Samuel Enibe
samuel.enibe at unn.edu.ng
Sat Jun 9 21:20:46 CEST 2012
Try this;
1. Let full name of file be myfile.csv
2. Read the entire file using the csv read function.
mystring = read_csv(myfile);
3. Extract the header lines (lines 1 to 5 in the example) into a new
variable as follows:.
myheader = mystring(1:5,:);
4. Delete the header lines from the variable mystring using the command
mystring(1:5,:) = [];
5. Convert the remaining object into a numeric variable as follows:
mydata = evstr(mystring).
6. Process the numeric data as usual.
I hope this helps.
Prof. Samuel Enibe
Department of Mechanical Engineering
University of Nigeria, Nsukka, Nigeria
-----Original Message-----
From: Tingsten
Sent: 09/06/2012 12.06.43 pm
Subject: [scilab-Users] 500mo Ascii file
Hello everyone,
I have got a 500mo ascii file that I would like to post process with Scilab
(
5.3.3 or 5.4) and I am struggling a lot….
My file looks like that:
*Header
Test number 1, 05/06/2012
6 Channels at 50000Hz
Data starts here:
Time,CH1,CH2,CH3,CH4,CH5,CH6
-10.000019,-0.660920,-0.136021,-0.120244,1.206482,-0.201057,-0.040760,
-9.999999,-0.605067,-0.136021,-0.124390,1.151813,-0.126591,0.002605,
-9.999979,-0.584123,-0.140555,-0.128536,1.025510,-0.040956,0.027115,
………*
Cause of the header I can’t use straight csv_read (or I need to del
ete the
header first with a text editor and then use it. That works but is not very
“clean”) so I would like to do it only with scilab.
What I do (and that does not work…):
First I check where start the data and analyse the format:
/f=mopen(file,’r’);data=mgetl(f,10);mclose(f); =>work
s fine/
Then I increase the stacksize and read the entire file :
/stacksize(‘max’);f=mopen(file,’r’);data
=mgetl(f,-1);mclose(f);/ =>works
fine
Then I try to extract some of the data:
/[n,Time,CHX]=msscanf(-1,data(6:$),”%f,%f”)/ => crashes
everytime (with
5.3.3 or 5.4)
But a
/[n,Time,CHX]=msscanf(-1,data(6:1000:$),”%f,%f”)/ => wo
rks fine (with 5.3.3
or 5.4)
Do you have some advice to open the whole file properly in scilab?
Thx you a lot for your help and have a great week-end.
--
View this message in context: http://mailinglists.scilab.org/500mo-Ascii-fi
le-tp4024324.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at
Nabble.com.
--
To unsubscribe from this mailing-list, please send an empty mail to
users-unsubscribe at lists.scilab.org
To check the archives of this mailing list, see
http://mailinglists.scilab.org/
More information about the users
mailing list