Have index of numbers and letters in title

조회 수: 15 (최근 30일)
Lukas Netzer
Lukas Netzer 2021년 5월 6일
답변: Image Analyst 2021년 5월 6일
I try to setup the title for one of my boxplots to use an index like that:
t{n} = abc123abc;
I tried using:
title('title', t{n})
title('title', string(t{n}))
title('title t{n]')
etc.
Is there a way to do it?
  댓글 수: 2
Jonas
Jonas 2021년 5월 6일
if you want the content of t{n} as string then use num2str(t{n})
Lukas Netzer
Lukas Netzer 2021년 5월 6일
tried it - this does not work, as the input is not numeric (only)

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

채택된 답변

KSSV
KSSV 2021년 5월 6일
It should be:
t{n} = 'abc123abc';

추가 답변 (1개)

Image Analyst
Image Analyst 2021년 5월 6일
n = 1; % Whatever...
% Assign cell contents. Some options depending on what you have to start with:
t{n} = 'abc123 blah fubar snafu'; % If you want a string (character array)
t{n} = sprintf('abc equals %d', 5); % If you have an integer constant or variable.
t{n} = sprintf('abc equals %f', pi); % If you have an floating point constant or variable.
t{n} = sprintf('abc equals %s', abc); % If you want to add a string variable to some constant text.
title(t{n}, 'FontSize', 20);
FAQ:

카테고리

Help CenterFile Exchange에서 Title에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by