Add String to Matlab Plot Annotation

24 visualizaciones (últimos 30 días)
david crowley
david crowley el 26 de Jul. de 2021
Respondida: Chunru el 26 de Jul. de 2021
I am trying to add an annotation to a plot that uses a variable from the workspace. I have used the below code, but the only output I get is 'Pf Size:'
Can someone please assist with the syntax?
dim = [.2 .5 .3 .3];
str = ('Pf Size:' num2str(pfSize));
annotation('textbox',dim,'String',str,'FitBoxToText','on');

Respuesta aceptada

Chunru
Chunru el 26 de Jul. de 2021
pfSize = 2;
dim = [.2 .5 .3 .3];
str = ['Pf Size:' num2str(pfSize)]; % use [] instead of ()
plot(rand(10,1))
annotation('textbox',dim,'String',str,'FitBoxToText','on');

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by