フィルターのクリア

How to plot rows of two matrices in different colors without for loop

3 ビュー (過去 30 日間)
H ZETT M
H ZETT M 2016 年 12 月 11 日
回答済み: dpb 2016 年 12 月 11 日
Hey guys, I need your help. So I got two matrices x and y. They are currently 4135*1441 large. So what I want to do is basically something like this:
figure
cc = jet(1441)
plot(x(1,:),y(1,:),'color',cc(1,:))
hold on
for i = 1: 1441
plot(x(i,:),y(i,:),'color',cc(i,:))
end
hold off
but without the for loop. Since the matrices are pretty large it takes forever to plot the picture. Would removing the for loop change the runtime, or will it take forever anyway ?

採用された回答

dpb
dpb 2016 年 12 月 11 日
Matlab is column-major...
plot(x.',y.')
will treat each column as an observation automagically. Colors will cycle through the default set so with so many lines you'll have many sets the same (but with so many lines/data points on a single plot, it'll probably just be a solid blob anyway, so may not matter much :) ).

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by