colour code plotted data according to column
1 回表示 (過去 30 日間)
古いコメントを表示
I have a 20000*20 matrix of data and I'd like to colour code the points depends on the column. e.g. data points from column one are blue, from column two are red...etc all the way to column 20.
I saw similiar answer from this post but for-loop doesn't work well for large amount of data points
I wonder if this can be done more efficiently?
0 件のコメント
回答 (1 件)
Riccardo Scorretti
2022 年 4 月 11 日
Simply like that, if I correclty understand your question:
% Generate some data
p = linspace(0, 2*pi, 20000);
data = zeros(numel(p), 20);
for n = 1 : 20
data(:,n) = n*sin(p);
end
figure
plot(data);
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!