MATLAB Answers

fscanf question with Arduino

조회 수: 37(최근 30일)
Darryl 2013년 2월 24일
답변: Kristian Cvetkov 2017년 11월 12일
I need to know how I can control the amount of Serial.println(variable_1) methods that get read during the fscanf() execution.
This is the code:
arduino = serial('COM4');
x = 1:1:60;
for i=1:length(x)
y(i) = fscanf(arduino, '%d');
% Plot data from arduino
If my Arduino sketch has multiple Serial.println() it seems to combine the variables within the Serial statements in the same vector. Is it possible for them to be separated?

채택된 답변

Walter Roberson
Walter Roberson 2013년 2월 24일
fscanf(arduino, '%d', 1);
  댓글 수: 3
Darryl 2013년 2월 25일
Thank you very much indeed. Much appreciated, will try that tomorrow.

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

추가 답변(1개)

Kristian Cvetkov
Kristian Cvetkov 2017년 11월 12일
How I can write data on my Arduino, after I read them in Matlab?

Community Treasure Hunt

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

Start Hunting!

Translated by