Plotting points on a graph every 15 minutes

5 visualizzazioni (ultimi 30 giorni)
Erin Flowerday
Erin Flowerday il 13 Lug 2021
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?

Risposte (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov il 13 Lug 2021
You had better use timer class:
https://www.mathworks.com/help/matlab/ref/timer-class.html

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by