Fprintf from a text file

1 回表示 (過去 30 日間)
pro
pro 2014 年 5 月 7 日
I have created a test example to send a signal from matlab and receive the response + plot. However the signal i want to send is much longer than the one in this example. I have tried reading from a file but i cant use the printf function with a vector column. dont want to use fwrite either as only printf works. Any ideas on a solution? Thanks
s = serial('COM3');
set(s,'BaudRate',9600);
s.InputBufferSize = 6000;
fopen(s);
t=1;
a=0;
fprintf(s,'9 8 7 6 5 4 3 2 1 0')
while(t<=10)
a =fscanf(s,'%d');
x(t,:) =[t a]
t=t+1;
plot(x);
drawnow;
axis auto;
grid on;
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by