Stroring data from text file into cell array
Mostrar comentarios más antiguos
Hi everyone,
Apologies for the stupid question, I am new to extracting data from txt files. Here is the problem, I have a lot of data stored in a txt file (in total
rows) which is of the following form:
802|201308|9|204307|40140|000|1|I|107|999|154000|107|4.125|R|N|FRM|CA|SF|92400|F113Q|N|360|01|Norges, N.A.|Norges, N.A.||F108X|
My attempt so far has been:
fileID = fopen('thetextfile.txt');
formatSpec = '%s';
N = 27;
C_text = textscan(fileID,formatSpec,N,'Delimiter','|');
fclose(fileID);
I am happy how the data has been stored, the only problem is that just the first row of the text file has been saved in C_text. In other words, C_text is a 27×1 cell array. The goal would be to have a 27x>2000000 celly array, which I can then manipulte further. I am not sure whehter this is feasible given the size of the txt file. If there is a better and more efficient way to do it then please let me know. Any help is appreciated.
Many thanks!
Robert
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Environment and Settings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!