Including a value inside an annotation
Mostrar comentarios más antiguos
I am trying to include a number which changes inside a recurring annotation.
This works - the number 48 is hard-coded:
annotation('textbox',[0.42 0.864 0.1 0.1],'String','L. St. Lawrence - INCREASE IN ISI (n=48)','EdgeColor','none', 'FontSize',12,'Color','black','FontWeight','bold')
This does not (note the insertion of a number q, which has been pre-allocated a value of 48):
annotation(['textbox',[0.42 0.864 0.1 0.1],'String','L. St. Lawrence - INCREASE IN ISI (n=',num2str(q),')','EdgeColor','none','FontSize',12,'Color','black','FontWeight','bold'])
The error I get is:
Error using annotation
First argument must be a valid annotation type or a handle to a figure, uipanel, or uitab.
Thanks for helping!
Respuesta aceptada
Más respuestas (1)
Sulaymon Eshkabilov
el 28 de Oct. de 2023
Editada: Sulaymon Eshkabilov
el 28 de Oct. de 2023
Here is the solution to this issue:
q = 48;
DIM = [0.42 0.864 0.1 0.1];
STR = strcat('L. St. Lawrence - INCREASE IN ISI (n= ', num2str(q), ' )');
annotation('textbox',DIM,'String',STR,'FitBoxToText','on','EdgeColor','none','FontSize',12,'Color','black','FontWeight','bold');
3 comentarios
Paul Barrette
el 28 de Oct. de 2023
Sulaymon Eshkabilov
el 28 de Oct. de 2023
Most welcome -sir!
Paul Barrette
el 29 de Oct. de 2023
Categorías
Más información sobre Parallel Computing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!