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?
回答 (1 件)
Sulaymon Eshkabilov
2021 年 7 月 13 日
0 投票
You had better use timer class:
https://www.mathworks.com/help/matlab/ref/timer-class.html
カテゴリ
ヘルプ センター および File Exchange で 2-D and 3-D Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!