simulink scope: adjust axis tick mark intervals (R2015b)

5 views (last 30 days)
Hi, I must be something stupid. I seem to have silly spacings for the time in minutes on my scope, but I can't see any way to change it. For example, I would like tick marks at 0, 300, 600, 900, 1200...3000. What am I not seeing? Kind regards,
  2 Comments
Jason
Jason on 3 Mar 2016
If you change your TimeUnits to "none" or "seconds" you should see a more natural, round number for the ticks.
I have created an enhancement request for TimeUnits of minutes to use better tick values.
Jan
Jan on 30 Jan 2025
Did you get an update of your request?
It would also be nice if we could set the XTicks and YTicks, as in MATLAB. Sometimes it is nice to see a grid that corresponds to a sampling or quantization interval.

Sign in to comment.

Answers (1)

Anudeep Kumar
Anudeep Kumar on 5 Feb 2025
Hey, I was facing the same issue, and  I found a workaround that worked well for me using the "To Workspace" block. This method allows you to export your data to MATLAB and take full advantage of MATLAB's plotting capabilities.
Here's how I did it:
First add a “To Workspace” block and connect the signal that is to be exported, configure the block to save data to MATLAB Workspace.
Then use the following MATLAB code to plot the data with custom tick settings:
% Assuming 'simout' is the logged signal from Simulink
time = simout.time;
data = simout.signals.values;
figure;
plot(time, data);
xticks(0:0.5:max(time)); % Set X ticks
yticks(-1:0.5:1); % Set Y ticks
xlabel('Time (s)');
ylabel('Signal');
title('Custom Plot with Specific Ticks');
I hope this helps!
  2 Comments
Jan
Jan on 6 Feb 2025
Edited: Jan on 6 Feb 2025
I did that already, but the simulation needs to be finished before that can run. However, I found a way to do it in the book [Modeling of Digital Communication Systems Using Simulink] by Giordano and Levesque.
They provided this code to add menu options to a scope window that gives all the control you have in MATLAB figures. It allowed me to make the modifications to the grids that I wanted. Just copy/paste it to the MATLAB command window after you've opened the scope window.
shh = get(0, 'ShowHiddenHandles');
set(0, 'ShowHiddenHandles', 'on');
set(gcf, 'MenuBar', 'Figure');
set(gcf, 'CloseRequestFcn', 'closereq');
set(gcf, 'DefaultLineClipping', 'Off');
set(0, 'ShowHiddenHandles', shh);
Anudeep Kumar
Anudeep Kumar on 14 Mar 2025
Hey @Jan
Thanks for sharing this workaround! worked for me as well.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!