Conversion to double from cell is not possible.

4 ビュー (過去 30 日間)
yousuf khan
yousuf khan 2012 年 1 月 5 日
Hello everybody,
line_style = { '-r', '-g', '-c', '-xk', '-hm', '-b' };
for i= 1: length(line_style)
plot (A,B,line_style(i),'linewidth',2)
end
for each new plot it should use a different line style for graphs but it gives the following error.
??? Error using ==> plot Conversion to double from cell is not possible.
Please help. Regards

採用された回答

the cyclist
the cyclist 2012 年 1 月 5 日
You want this instead:
plot(A,B,line_style{i},'linewidth',2)
Notice the use of curly brackets to access line_style; that accesses the contents of that element of the cell array, rather than the cell itself.
  2 件のコメント
yousuf khan
yousuf khan 2012 年 1 月 5 日
Thanks a lot. It is really helpful :)
saurabh kumar
saurabh kumar 2013 年 4 月 18 日
Great Answer ...
Thanks a ton
saurabh srivastava

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by