How do I append a timestamp in a loop?

2 visualizaciones (últimos 30 días)
farzad
farzad el 6 de Mayo de 2020
Comentada: farzad el 7 de Mayo de 2020
Hi All
trying the following code, I noticed that the output has not appended the t array for m times but only for two times. one the original and once appended. How should I
modify it in a way that the array t, is appended m times ?
resol is the time stamp resolution
for n=1:size(m)
if n==1
Ttot=t.';
else
Ttot= [Ttot,t.'+Ttot(end)+resol];
end
end
  2 comentarios
jessupj
jessupj el 6 de Mayo de 2020
Editada: jessupj el 6 de Mayo de 2020
what is m?
size(m) is probably a 2x1 vector of length and width of m (assuming m is a 2d array).
try 'length(m)' for the loop, or e.g. size(m,1) to identify which dimension of m to iterate over.
farzad
farzad el 7 de Mayo de 2020
thank you very much ! that was right !

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by