There is Arduino, which is in the com port sends data from the sensor every 100 MS. Want to smooth noise in matlab and plot graphs. In array to record the data stream? Or, better yet, maybe you can do it in realtime?
How to open a port know get single value by using fgets(s). In an array multiple values to send not think. Please help.
NB.BaudRate = BaudRate;
NB.IOFileName = IOFileName;
try
s = serial(NB.IOFileName);
end
system(sprintf('stty -F %s %d', NB.IOFileName, NB.BaudRate));
NB.IOid = fopen(NB.IOFileName, 'w+');
k = 0;
while(1)
b = fread(NB.IOid, 1, 'uint8'); % a Single byte from the port
k = k + 1;
byte_array(k) = b;
end
Find more questions by tags ArraysMATLABSerial port