Effacer les filtres
Effacer les filtres

Have index of numbers and letters in title

7 vues (au cours des 30 derniers jours)
Lukas Netzer
Lukas Netzer le 6 Mai 2021
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 commentaires
Jonas
Jonas le 6 Mai 2021
if you want the content of t{n} as string then use num2str(t{n})
Lukas Netzer
Lukas Netzer le 6 Mai 2021
tried it - this does not work, as the input is not numeric (only)

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 6 Mai 2021
It should be:
t{n} = 'abc123abc';

Plus de réponses (1)

Image Analyst
Image Analyst le 6 Mai 2021
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:

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by