How to read analog signal from Arduino in Matlab?
5 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Raghava S N
on 26 Sep 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.
0 Comments
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!