필터 지우기
필터 지우기

Figure Title with String using eval command

조회 수: 2 (최근 30일)
Charles Martineau
Charles Martineau 2012년 6월 11일
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!

채택된 답변

Walter Roberson
Walter Roberson 2012년 6월 11일
  댓글 수: 1
Charles Martineau
Charles Martineau 2012년 6월 11일
yes the link helped me to solve my problem. thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by