Conversion to double from cell is not possible.

4 visualizaciones (últimos 30 días)
yousuf khan
yousuf khan el 5 de En. de 2012
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

Respuesta aceptada

the cyclist
the cyclist el 5 de En. de 2012
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 comentarios
yousuf khan
yousuf khan el 5 de En. de 2012
Thanks a lot. It is really helpful :)
saurabh kumar
saurabh kumar el 18 de Abr. de 2013
Great Answer ...
Thanks a ton
saurabh srivastava

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by