Reading text file
paul.carrico at free.fr
paul.carrico at free.fr
Mon Jun 13 11:58:29 CEST 2011
Dear All
I'm currently trying to read a (huge = 150000 lines and up to 15 column) text file including strings and numbers ... the columns are separated by spaces
- csv_readwrite only accept commas as separation character otherwise it fails !
- using read_csv is rather long ... I mean more then an hour to read a record the file !!!!!
Does somebody has efficient algorithm for such reading ?
Thanks
Paul
PS : example of code use
###########################################################################
mode(0);
PATH_FILE = get_absolute_file_path("read_csv.sce");
FILE_NAME = 'bouteille_mixte_p2.msh';
timer();
stacksize('max');
A = read_csv(PATH_FILE + FILE_NAME,ascii(32));
[nl,nc] = size(A);
Nbre_noeuds = eval(A(5,1));
Nbre_elements = eval(A(5+Nbre_noeuds+3,1));
Noeuds = [];
Elements = [];
Noeuds = evstr(A(6:Nbre_noeuds+5,1:4));
Elements = evstr(A(Nbre_noeuds+9:Nbre_noeuds+Nbre_elements+8,:));
Elements(3) = [];
Elements(5) = [];
temps_cpu = timer();
printf("Temps lecture = %g\n",temps_cpu);
clear nl; clear nc; clear A;
More information about the users
mailing list