Plotting color data from cell array using plot()
Show older comments
I want to quickly plot several hundred traces quickly Using a for loop tends to take quite some time. I found a trick to do it using the following example,
x1 = [1 2 3]
x2 = [2 3 4]
y1 = [1 2 3]
y2 = [3 5 6]
xdata = {x1 x2}
ydata = {y1 y2}
plot(xdata{:}, ydata{:})
BUT
what if i want to color code the data in a specific way? I tried the following, but it doesnt work.
x1 = [1 2 3]
x2 = [2 3 4]
y1 = [1 2 3]
y2 = [3 5 6]
c1 = [1 0 1]
c2 = [0 1 0]
xdata = {x1 x2}
ydata = {y1 y2}
cdata = {c1 c2}
plot(xdata{:}, ydata{:}, 'color', cdata{:})
Is there any way to assign additional information to the information being plotted using plot() such as color, or line style? If not, is there another function? Or must a for loop be used for this
Accepted Answer
More Answers (0)
Categories
Find more on Annotations 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!