MATLAB: How to read the actual analog read

arduino with matlab

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

Best Answer

You can actually read the analog value using readVoltage.
You just need to make some calculation.
analog = readVoltage * (1023 / 5);