Hi guys, im currently working on EMG recording trough Arduino and EMG Shield. the problem is that i have to record the signal from two muscles, since that, i have to read two values from to arduino and save into a Matlab variable the kind of values that comes from arduino are two numbers like 514;125 so, how can i read those values and save them into a matrix with two columns?? this is my code from recording so far.
if true % code
enddelete(instrfind({'Port'},{'COM3'})); port=serial('COM3');port.BaudRate=115200; %
warning('off','MATLAB:serial:fscanf:unsuccessfulRead');fopen(port); Fs=1/5000;t=0;i=1;tic; tmax=2;while t<tmax; if toc >(Fs) valor=fscanf(port,'%d') %here i read the output from arduino
raw(i)=valor(1,1); t=t+toc; tic; endfclose(port);delete(port);
thx
Best Answer