Plotting points on a graph every 15 minutes

I am currently plotting points on a graph every hour which is within a while loop, but I am trying to adjust that so the points are plotted every 15 minutes.
This is what my original code looks like:
contraction(icount, 1)=newtime;
contraction(icount, 2)=radius;
icount = icount +1;
end
...
figure
plot(contraction(:,1),contraction(:,2)/contraction(1,2),'-o');
axis([0 100 0 1]);
save data.mat contraction
The newtime is the hour time.
And so I tried multiple ways to adjust it to 15 minutes but none of them have worked. I was sure this following code would fix the problem but it still isn't working. Here is the code:
for(c=newtime:+0.025:newtime+1)
contraction(icount, 1)=c;
contraction(icount, 2)=radius;
end
contraction(icount, 1)=newtime;
contraction(icount, 2)=radius;
icount = icount +1;
end
...
figure
plot(contraction(:,1),contraction(:,2)/contraction(1,2),'-o');
axis([0 100 0 1]);
save data.mat contraction
Can anyone help me solve this?

Respuestas (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 13 de Jul. de 2021

0 votos

You had better use timer class:
https://www.mathworks.com/help/matlab/ref/timer-class.html

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 13 de Jul. de 2021

Respondida:

el 13 de Jul. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by