필터 지우기
필터 지우기

Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 0-by-0.

조회 수: 3 (최근 30일)
if ~isempty(instrfind)
fclose(instrfind);
delete(instrfind);
end
A = zeros(64,1);
B = zeros(64,1);
C = zeros(64,1);
D = zeros(64,1);
Arduino=serial('COM3','BaudRate',9600);
fopen(Arduino);
writedata=uint16(500); %0x01F4
fwrite(Arduino,writedata,'uint16') %write datac
for i=1:64 %read 64 lines of data
A(i,:) = fscanf(Arduino,'%f');
end
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 0-by-0.
Error in testing (line 15)
A(i,:) = fscanf(Arduino,'%f');

채택된 답변

KSSV
KSSV 2020년 8월 26일
Try:
count = 0 ;
A = zeros([],1) ;
for i=1:64 %read 64 lines of data
temp = fscanf(Arduino,'%f') ;
if ~isempty(temp)
count = count+1 ;
A(count,:) = temp ;
end
end
  댓글 수: 3

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by