Plotting an unknown number of lines in different colours
Show older comments
Hi all, First post here, so please do bear with me!
Right, I'm running some simulations that export to text files containing tables of data. Only the first and 3rd columns of data are useful. Each simulation has a seperate text file and they are named/ordered with a corresponding number.
So I've got a matlab m-file to import the data and sort it out, so that only the useful columns are stored.
Basically, what I want is a plot of the error versus iteration number. At the moments there's six files, so the table I finish with is 12 colums wide:
x1, y1, x2, y2......x12, y12 (we'll call this table results for now)
Originally I put it in a for loop:
for i = 1:6
figure(1)
hold on
plot(results(:,((2*i)-1)), results(:,(2*i)))
end
but the problem with this, is that it makes all the lines the same colour. I want to have it automated, because the number of files will vary and currently the m-file identifies/counts how many result files there are...
Any ideas?
Accepted Answer
More Answers (0)
Categories
Find more on Tables 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!