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

2 Ansichten (letzte 30 Tage)
On Y axis instead of a rotational speed of 10000 rpm I want to be write 10,000 rpm!

Akzeptierte Antwort

Umar
Umar am 12 Okt. 2024

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 Kommentare
Octavian
Octavian am 13 Okt. 2024
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 am 13 Okt. 2024
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!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Shubham
Shubham am 12 Okt. 2024
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!

Produkte


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by