Conversion to double from cell is not possible.

3 次查看(过去 30 天)
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by