How to show a figure in the MATLAB App designer with both X and Y axis from signal in simulink real-time model?

4 visualizaciones (últimos 30 días)
How can we customize the x-axis of the instrumented axes in MATLAB App (with model running on Speedgoat)? I wanted to plot Speed vs Torque (signals from Simulink model) (in the axes) instead of separately plotting them with respect to time.

Respuestas (1)

Tejas
Tejas el 17 de Sept. de 2024
Hello Devesh,
Start by adding an 'Axes Component' in App Designer. Below this component, place a button and assign a 'ButtonPushed' callback to it. Within this callback, follow these steps:
target_object = slrealtime('TargetPC1');
speedData = getsignal(target_object, 'blockPath', portIndex);
torqueData = getsignal(target_object, 'blockPath', portIndex);
  • Use the 'plot function to display the speed and torque data.
plot(app.UIAxes, speedData, torqueData);
With this setup, each time the button is clicked, real-time speed and torque data will be fetched and plotted in App Designer.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by