How do you plot sequentially numbered files on one plot?
Show older comments
I am new to MATLAB and have created ascii folders with 30 .asc files in each that I would like to plot on one graph. I have tried to figure out how to do this, but have a limited understanding of MATLAB. I know I need to include the matrix size (200:1), but this is actually 2 columns with x,y values in it.
So far all I have is:
Files = ('sample1_1_*.asc');
clf,figure,hold on;
for k = 1:30
plot(Files(k,:))
end
But this gives an error of 'Index exceeds matrix dimensions.'
Any help would be much appreciated or if you could direct me to a relevant post that would be fantastic!
3 Comments
S B
on 6 Sep 2017
It's caused because the file name is just a 1-line string in matlab. "Files" does not store the 30 asc file names correctly (hence you'll get an index exceed error). I think I can give you a function that'll work, but could you copy and paste just the first 5 data points for one asc file that you want to plot? Just so I can see if matlab has the right file reader.
Accepted Answer
More Answers (1)
Walter Roberson
on 6 Sep 2017
0 votes
2 Comments
S B
on 6 Sep 2017
Walter Roberson
on 6 Sep 2017
.asc is not a standardized file format. We would need to know the data format in the files. Is there a header? How many columns? What is the delimiter between the columns?
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!