How to read analog signal from Arduino in Matlab?

조회 수: 3 (최근 30일)
Venkatesh Kumar V
Venkatesh Kumar V 2022년 4월 8일
답변: Raghava S N 2024년 9월 26일
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

답변 (1개)

Raghava S N
Raghava S N 2024년 9월 26일
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.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by