- 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
- 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
- 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
How to plot data sensor on GUI Matlab
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
John
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.
0 comentarios
Respuesta aceptada
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:
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!
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!