Extract data from text file and save them to 3D array
Mostra commenti meno recenti
Hello! I have a small question here. I got some text files in form as following:
08-September-2015 10:44
28 lines in following concentration table = NCONC+1
Conc. %SD /Cr+PCr Metabolite
0.599 2% 0.106 Mac
2.216 6% 0.393 Ala
0.000 999% 0.000 Asp
......
There are some hundred lines following, too. However, I only need the first element from the fifth line (2.216), how can I extract it?
Besides, I have hundreds of this kind of files, from which I need to extract this element from above mentioned place. The files are created from a for loop with three variables. I want to save the extracted elements into a 3D array according to these three variables. Can someone help me on this?
I wrote some codes to open the files, the variables of the for loop are in the codes:
directory= 'C:\Users\karl\Documents\COORD\';
for lb=19:11:30;
for snr=20:105:230;
for GC=2.5:0.025:2.55;
filename = [directory, 'Gln', num2str(lb), 'HzSNR', num2str(snr), 'C' , num2str(GC), 'Mice'];
fid=fopen(filename);
fclose(fid);
end;
end;
end;
So, the three variables are lb, snr and GC, the files which contains the data I need are also named in a way after these three variables.
Can someone help me? Thank you very much!
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
