How to Split numbers into matrix
Show older comments
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
end
delete(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;
end
fclose(port);
delete(port);
thx
Accepted Answer
More Answers (0)
Categories
Find more on Instrument Control Toolbox 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!