i'm trying to get data from force sensors using Xbee and the buffer size is 512 i want the xbee to collect the data for 1 minute exactly
조회 수: 1 (최근 30일)
이전 댓글 표시
clc; close all; clear all;
delete(instrfindall);
s = serial ( 'COM5', 'BaudRate', 115200);
fopen(s);
format shortg
bt = clock
et= clock+[0 0 0 0 1 0]
while bt-et<=0
data= fread(s);
bt= clock;
end
댓글 수: 0
답변 (1개)
Walter Roberson
2014년 3월 11일
MATLAB cannot resolve time infinitely precisely, so you cannot collect data to better accuracy than 1 minute +/- 1 microsecond. MATLAB also is not designed to be able to interrupt an fread() operation.
You would also be better off if you told fread() how much data you want to read at a time.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Clocks and Timers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!