How can I synchronize a printing for a vector?

1 visualización (últimos 30 días)
Carlos Ramada
Carlos Ramada el 25 de Mzo. de 2014
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?

Respuestas (0)

Categorías

Más información sobre Data Types en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by