How to read analog signal from Arduino in Matlab?

3 visualizaciones (últimos 30 días)
Venkatesh Kumar V
Venkatesh Kumar V el 8 de Abr. de 2022
Respondida: Raghava S N el 26 de Sept. de 2024
sir , i want the serial monitor data in Arduino to be accessed in Matlab.some people told me to use data streamer in Excel to store the data in Excel sheet but everytime when i open the excel sheet it always ask me to do some common procedure like
1.Connect a Device
2.Choose your Device to stream data
whether it is possible to make all this process in automatic manner in Matlab

Respuestas (1)

Raghava S N
Raghava S N el 26 de Sept. de 2024
Hi Venkatesh Kumar,
The first step is to check if the Arduino hardware being used is connected to the computer and is accessible from MATLAB. To do this, follow the steps in this link - https://www.mathworks.com/help/matlab/supportpkg/connect-to-arduino-hardware.html.
To continuously read analog values from the Arduino hardware, making use of a loop can help. The following link has example code to continuously read analog values from one pin (“A0”) of Arduino and store them in a MATLAB matrix - https://www.mathworks.com/matlabcentral/answers/1881002-how-to-read-analog-data-instantaneously-from-arduino-to-matlab.
The matrix “dataMatrix” from the example code can then be written to an excel spreadsheet using the “writematrix” function. Execute the following command after the loop in the example code-
writematrix(dataMatrix, 'data.xls')
Refer to this link for more information on the “writematrix” function- https://www.mathworks.com/help/matlab/ref/writematrix.html#:~:text=Write%20Matrix%20to%20Spreadsheet%20File.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by