How to plot data sensor on GUI Matlab

3 visualizaciones (últimos 30 días)
John
John el 8 de Sept. de 2024
Editada: Shubham el 8 de Sept. de 2024
I'm trying to use data sensor which is tranfer from stm32f411 to draw chart following real time on GUI Matlab but i can not. Hope everyone can help me and let me know the commands or documents. Thank you very much.

Respuesta aceptada

Shubham
Shubham el 8 de Sept. de 2024
Editada: Shubham el 8 de Sept. de 2024
Hey John,
I believe you need assistance in plotting real time data from an STM32F411 sensor.
In order to achieve this, you would need to:
  1. Setup a connection to serial port and read the data. For this purpose you can use the "serialport" function to establish a communication channel with the serial port. You can find the documentation for the function here: https://www.mathworks.com/help/matlab/ref/serialport.html
  2. For creating a real time plot, retrieve the data chunks from the serial port and keep adding them to the same figure by using the "hold on" command or the "drawnow" function. You can also have a look at the following MATLAB Answer describing a few ways to plot in real time: https://www.mathworks.com/matlabcentral/answers/83192-plot-in-real-time
  3. In the end, you need to close the serialport objects. Leverage the following post for understanding the steps needed for closing the serial port: https://www.mathworks.com/matlabcentral/answers/886269-how-do-i-close-serialport-objects
As an alternative to the above proposed steps, make use of the following File Exchange Submission which has a MATLAB script designed for plotting graphs by accessing serial port data in real time: https://www.mathworks.com/matlabcentral/fileexchange/28941-real-time-data-plot-from-serial-port
I hope this helps!

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by