Importing data from an ascii file.
Ältere Kommentare anzeigen
I want to import data into a matrix in matlab. The issue arises because I have a bunch of junk that I don't want before my data. How can I import my data into matlab output it in a matrix in a certain file name. My data looks like this
JUNK JUNK JUNK JUNK JUNK JUNK JUNK JUNK JUNK JUNK JUNK
#' Start of Data:
Data I want
The "# Start of Data:" is actually there I want everything after that line. Any assistance you can give would be very appreciated.
Antworten (2)
Joseph Cheng
am 3 Apr. 2014
0 Stimmen
you can use dlmread() which you can specify the specific row and column to start importing the data. One thing to remember dlmread starts counting with 0 not 1 like the rest of matlab. so the first column and row is both 0.
2 Kommentare
Matthew
am 3 Apr. 2014
Joseph Cheng
am 3 Apr. 2014
I'd test it out? but i think it may be 199 line but easiest way to check is to either try it or open the txt file in a text editor that displays line numbers and see whether the junk is from 0 to 199 or 1 to 200. Both would have 200 lines but dlmread counts the first row as 0.
Image Analyst
am 3 Apr. 2014
Use the new readtable function:
t = readtable(fullFileName, 'HeaderLines', 1); % Skip 1 line in the file.
1 Kommentar
Joseph Cheng
am 3 Apr. 2014
ooo... when did that come out?
Kategorien
Mehr zu MATLAB 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!