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 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