How can I read the actual analog read?
Show older comments
Hi, MathWorks communities.
I have a question regarding the "readVoltage(a, ' ') command. When I run my code it shows a voltage data. But when I try to find the maximum or minimum value it shows something else. Can anyone tell me why it happens like that?
clear all;
a = arduino();
for r = 1:10
H(1,r) = readVoltage(a , 'A0')
pause(1);
end
ts = timeseries(H(1,:),1:length(H)); %(data)(time)
save('ardu1','ts','-v7.3')
This is the answer from command window.
H =
Columns 1 through 6
0.2639 0.2639 0.2639 0.2639 0.2639 0.2639
Columns 7 through 10
0.2639 0.2639 0.2688 0.2639
>> maximum = max('ardu1')
maximum =
117
>> minimum = min('ardu1')
minimum =
49
Accepted Answer
More Answers (1)
Walter Roberson
on 5 Dec 2016
0 votes
max('ardu1') means to apply max() to the vector that is the character string 'a', 'r', 'd', 'u', '1'.
There is no MATLAB operator for finding the max() of a .mat file.
Consider max(H)
4 Comments
Walter Roberson
on 5 Dec 2016
You stored them in H
SyukriY
on 5 Dec 2016
SyukriY
on 5 Dec 2016
Categories
Find more on MATLAB Support Package for Arduino Hardware 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!