Excuse me, could you help me correctly name my Vcm1, Vcm2, Vcm3, Vcm4 in num2str?

3 ビュー (過去 30 日間)
Carolina
Carolina 2024 年 7 月 5 日
移動済み: Stephen23 2024 年 7 月 5 日
grid on
xlabel('X')
ylabel('Y')
zlabel('Z')
title(['Tiempo de ',num2str(t(i)),'s'],'FontSize',18)
axis([-60,60,-60,60,0,60])
legend('Eslabón 1','Eslabón 2','Eslabón 3','Eslabón 4','FontSize',16)
dim = ([0.8 0.4 0.1 0.2])
annotation('textbox',dim,'String',num2str(['Vcm1','Vcm2','Vcm3','Vcm4']), 'FontSize';15) Invalid expression.
view(100,35)
pause(0.01)

回答 (1 件)

Garmit Pant
Garmit Pant 2024 年 7 月 5 日
編集済み: Garmit Pant 2024 年 7 月 5 日
Hello Carolina
You can add text annotations to your graph using the ‘textbox’ parameter of the “annotations” function. To add a list of strings to the textbox, you need to use a cell array. Add the following code snippet to your code to correctly pass the strings to the “annotations” function.
annotation('textbox', dim, 'String', {'Vcm1', 'Vcm2', 'Vcm3', 'Vcm4'}, 'FontSize', 15)
If 'Vcm1', 'Vcm2', 'Vcm3' and 'Vcm4' are variables with numerical values, you can covert them to a string and pass them to the "annotation" function. Kindly follow the code scippet below:
txtAnnotations = sprintf('%.2f, %.2f, %.2f, %.2f',Vcm1,Vcm2,Vcm3,Vcm4);
annotation('textbox',dim,'String',txtAnnotations, 'FontSize',15)
You can refer to the following documentation link of the “annotation” function for further understanding:
I hope you find the above explanation and suggestions useful!
  3 件のコメント
Carolina
Carolina 2024 年 7 月 5 日
移動済み: Stephen23 2024 年 7 月 5 日
Excuse me, how do I get the speed values ​​Vcm1, Vcm2, Vcm3, Vcm4 to be seen on the graph?
Carolina
Carolina 2024 年 7 月 5 日
移動済み: Stephen23 2024 年 7 月 5 日

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDesktop についてさらに検索

タグ

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by