Reading values from a text file and converting to array.
Ältere Kommentare anzeigen
I have a text file 'U.txt' which has data as follows:
# x 0 0.3 0.4
# y 0 0 0
# z 0 0 0
# Time
0.000125 (0.101993 0 0) (0.100009 0 0) (0.100009 0 0)
0.00025 (0.14199 0 0) (0.0998676 0 0) (0.0976896 0 0)
0.000375 (0.161106 0 0) (0.0989464 0 0) (0.0895835 0 0)
0.0005 (0.178717 0 0) (0.0960872 0 0) (0.0763535 0 0)
I want to extract the values of each column (without the header) into respective arrays.example:
Array1= 0.000125 0.00025 0.000375 0.0005
Array2= 0.101993 0.14199 0.161106 0.178717
Array3= 0.100009 0.0998676 0.0989464 0.096872
Array4= 0.100009 0.0976896 0.0895835 0.0763535
Kindly help me out. Thanks in advance
1 Kommentar
rifat
am 28 Mai 2014
could you please attach the text file?
Akzeptierte Antwort
Weitere Antworten (1)
Pedro Rodenas
am 11 Jun. 2017
0 Stimmen
Thank you very much!
Kategorien
Mehr zu Text Files finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!