Plotting points on a graph every 15 minutes

5 views (last 30 days)
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?

Answers (1)

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

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!