Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. %%% Introducir datos por el COM %%%
  2. %delete(instrfind({'Port'},{'COM3'})); % Se cierra por si en algun momento estaba abierto de antes
  3. %s = serial('COM3','BaudRate',19200,'Terminator','CR/LF');
  4. %warning('off','MATLAB:serial:fscanf:unsuccessfulRead');
  5. % Abrir puerto
  6. %fopen(s);
  7. % Eliminar posibles datos recibidos hasta ahora
  8. %flushinput(s)
  9.  
  10. tmax=100; % Tiempo maximo lectura (segundos)
  11. tic
  12.  
  13. %while <= tmax
  14. %t=toc
  15. data='19.2,20.8,120.5';
  16. C = strsplit(data,',');
  17. %for k=1:3
  18. % vector(k,:)=cell2mat(C(k))
  19. %end
  20. vector=cell2mat(C(1));
  21. S1=cell2mat(C(1));
  22. S2=cell2mat(C(2));
  23. %S3=cell2mat(C(3))
  24. vector(1,:)=S1;
  25. vector(2,:)=S2;
  26. a=vector(1,:)
  27. a=a+1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement