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 CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by