How can I synchronize a printing for a vector?

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Data Types 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by