Plot several lines (looping through line styles in cell array) in Matlab

送分小仙女□ 提交于 2019-12-02 03:38:59

You should write:

plot(xint,test(ii,:),...
        LineSpec{ii},...
        'linewidth',2);

LineSpec is a cell array, so LineSpec(ii) returns a cell, while plot asks for a character array as line properties.

you can see the difference when you call LineSpec:

>> LineSpec{1}
ans =
-y
>> LineSpec(1)
ans = 
    '-y'

When the output is a cell then the answer is indented and has the single-quote marks.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!