SCOPE TO GUI AXES NOT FITTING
2 ビュー (過去 30 日間)
古いコメントを表示
How do I fix my axes to match the scope output? This is my code:
function EnableButtonPushed(app, event)
desiredSpeedValue = app.DesiredSpeedEditField.Value;
assignin('base', 'desired_speed', desiredSpeedValue);
assignin('base', 'KpOut', app.KpEditField.Value);
assignin('base', 'KiOut', app.KiEditField.Value);
assignin('base', 'KdOut', app.KdEditField.Value);
sim('finalfuzzy', 'StopTime', '10');
dataout = evalin('base', 'dataout');
plot(app.SpeedPlot,dataout.time,dataout.signals.values)
0 件のコメント
回答 (1 件)
Aravind
2024 年 10 月 11 日
The issue you are experiencing occurs when the tick values on the x and y axes do not match their labels. To fix this, you can manually set the ticks and their labels for both axes of the graph. You can do this by adding the following lines of code before calling the plot function:
app.SpeedPlot.XTick = 0:10; % x ticks will be integers from 0 to 10
app.SpeedPlot.XTickLabel = string(0:10); % set the x tick labels as strings of integers from 0 to 10
app.SpeedPlot.YTick = 0:10; % y ticks will be integers from 0 to 10
app.SpeedPlot.YTickLabel = string(0:10); % set the y tick labels as strings of integers from 0 to 10
These lines set the ticks on the x and y axes to integers from 0 to 10. You can adjust these values according to your requirements.
For more information about specifying axis tick values and labels, you can refer to the official MathWorks documentation at the following link: https://www.mathworks.com/help/matlab/creating_plots/change-tick-marks-and-tick-labels-of-graph-1.html.
I hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Labels and Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!