How can I synchronize a printing for a vector?

1 回表示 (過去 30 日間)
Carlos Ramada
Carlos Ramada 2014 年 3 月 25 日
Hi fellows,
I'm trying to synchronize a printing in matlab. I mean, I have a vector Mx1 and want to display data in a txt file on a frequency of 60 Hz. I tried this code:
choose = input('Introduce the number of steps \n'); %% number of steps of the trajectoty x = (choose-1)*1; %% total time y = [0:2:x*2]; %% trajectory points b = 0;
for t = [0:1:x] %% I used 1 sec instead of the 16ms (60Hz) just for monitoring. Just a test a = b+1; fid = fopen('c:\\coeffs.txt','wt'); %% function to print in a txt file fprintf(fid,'%f',y(a)); fclose(fid); b = b+1; end
The thing is that vector t didn't generate an actual time vector. I wasn't able to see the values changing in my txt file even using a 1 sec gap.
Do you guys know how to fiz it or have a better way to do that?

回答 (0 件)

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by