How can I synchronize a printing for a vector?

1 view (last 30 days)
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?

Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!