Figure Title with String using eval command

3 visualizaciones (últimos 30 días)
Charles Martineau
Charles Martineau el 11 de Jun. de 2012
Hi all,
say that I type in matlab the following:
s1='ALCOA';
s2='APPLE';
s3='ACCO BRANDS';
s4='ADOBE SYSTEMS';
later on I plot a graph and I want to use in the title one of the names above. So I do the following:
titstr(1)={eval(['s',int2str(i)])};
title(titstr,'VerticalAlignment','middle');
%Where _i_ refers to the number in the loop that corresponds to s1, s2, s3, or s4.
I get the following error:
Error using subsindex
Function 'subsindex' is not defined for values of class 'cell'.
Why do I get this error?
Thanks!

Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Jun. de 2012
  1 comentario
Charles Martineau
Charles Martineau el 11 de Jun. de 2012
yes the link helped me to solve my problem. thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by