Different line style and color in cell

3 次查看(过去 30 天)
I have a 1 × 4 cell, with each cell containing an array of 1 × 15. I want to plot the cell using different line style and color.

回答(1 个)

Mehmed Saad
Mehmed Saad 2020-5-19
you can use for loop or you can use cellfun.
data= {rand(1,15) rand(1,15) rand(1,15) rand(1,15)};
line_style = {'-','--',':','-.'};
line_color = {'r','g','b','k'};
figure,hold on
cellfun(@(x,y,z) plot(x,'LineStyle',y,'LineWidth',2,'Color',z),data,line_style,line_color)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

产品


版本

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by