one can use decimal symbol and digit grouping symbol in matlab simulink graphics

조회 수: 2 (최근 30일)
On Y axis instead of a rotational speed of 10000 rpm I want to be write 10,000 rpm!

채택된 답변

Umar
Umar 2024년 10월 12일

Hi @Octavian,

Your task is to modify the Y-axis labels of a MATLAB plot to display the rotational speed in a more readable format. Specifically, instead of showing a speed of 10000 rpm, you want it to be formatted as 10,000 rpm.

% Modify Y-axis ticks to display in the desired format
yticks([0 5000 10000 15000 20000]); % Set specific Y-ticks
yticklabels({'0', '5,000', '10,000', '15,000', '20,000'}); % Custom labels

The yticks function is used to specify the locations of the ticks on the Y-axis. In this case, set ticks at 0, 5000, 10000, 15000, and 20000. The yticklabels function allows you to customize the labels for these ticks, format the label for 10000 as '10,000' to enhance readability. For more information on yticklabels, please refer to

https://www.mathworks.com/help/matlab/ref/yticklabels.html?searchHighlight=yticklabels&s_tid=srchtitle_support_results_1_yticklabels

As an example, please see attached.

Hope this helps.

  댓글 수: 8
Octavian
Octavian 2024년 10월 13일
Hi Umar,
It work very well/
Thank you!
Can you give me your email address for for other possible questions?
my email: g2tavi@yahoo.com
Umar
Umar 2024년 10월 13일
Hi @Octavian,
Thank you for your positive feedback! I'm glad to hear that everything is working well for you. Regarding your request for my email address, I prefer to keep our communication through this platform to ensure privacy and security. However, feel free to reach out with any questions here, and I'll be more than happy to assist you!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Shubham
Shubham 2024년 10월 12일
Hey Octavian,
In order to format the tick labels for the plots for a MATLAB figure, you can use the "ytickformat" function with "fmt" input argument. Refer to the following documentation: https://www.mathworks.com/help/matlab/ref/ytickformat.html#bvayhxa-1-fmt
x = 1:5;
y = [1000 3000 5000 7000 10000];
plot(x,y,'-V')
ytickformat('%,4.4g')
As far as I understand, this functionality is not directly available in Simulink Scopes. However I would suggest you to save the data into MATLAB workspace and create the figure in MATLAB itself. Have a look at the following blog by @Guy Rouleau: https://blogs.mathworks.com/simulink/2010/06/22/how-to-customize-the-simulink-scope/
I hope this helps!

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by