how can I edit txt file?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Muhsin
am 4 Feb. 2017
Kommentiert: Walter Roberson
am 5 Feb. 2017
Hello; I am a new user.Can anyone help me edit the txt file that is attached. there are eight columns in the file and I would like to make one column. The order should be from left to right. After first row has been put in order in the column, the command should do the same the for second row. Hope this is a clear explanation. Thank you. Regards, Muhsin A
2 Kommentare
Image Analyst
am 4 Feb. 2017
It would certainly be a lot easier if you could have the file written out with a delimiter between the numbers. Is that possible?
Akzeptierte Antwort
Image Analyst
am 4 Feb. 2017
This works:
txt = fileread('mineral 90.txt');
numbers = cell2mat(textscan(txt, '%f')) % Convert text to doubles.
0 Kommentare
Weitere Antworten (1)
Walter Roberson
am 4 Feb. 2017
Once you have the data read in to variable DATA, then DATA.' would rearrange it with the data down the columns instead of across the rows.
14 Kommentare
Walter Roberson
am 5 Feb. 2017
It is showing you all of the columns, which is to say all 1 of them. You have been vague about what you want the output to be.
DATA.'
would switch all the rows and columns, giving you 8 rows and over 2000 columns.
reshape(DATA.',[],1)
will give you a single column result which is the elements from the first row first, then the elements from the second row, then the elements from the third row, and so on.
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!