Use Double Array Values to Label Plot
Mostrar comentarios más antiguos
I have a variable 'xx' that is a 1x9 double. I want to use those values to label the points along the line in plot(t,xx)
This is my code
Ts = 1/8;
t = 0:Ts:1;
x = @(t) cos(2*pi*t-(pi/2));
xx = x(t);
labels = {'Sample 1', 'Sample 2', 'Sample 3', 'Sample 4', 'Sample 5', 'Sample 6', 'Sample 7', 'Sample 8', 'Sample 9'};
plot(t,xx,'rd-', 'linewidth', 1.5, 'MarkerSize', 9, 'MarkerFaceColor', 'w'), grid on
text(t,xx,labels)
2 comentarios
Would making labels = string(xx) work?
Ts = 1/8;
t = 0:Ts:1;
x = @(t) cos(2*pi*t-(pi/2));
xx = x(t);
labels = string(xx);
plot(t,xx,'rd-', 'linewidth', 1.5, 'MarkerSize', 9, 'MarkerFaceColor', 'w'), grid on
text(t,xx,labels)
collegestudent
el 28 de En. de 2023
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Annotations 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!


