use of for loop for time shift
2 views (last 30 days)
Show older comments
I have a data set in two coloums, time and number of events. for every time we have to pick teh crossponding value from second coloumn. I did this by for loop at initial stage. Now I want to pick the number of events in two hours with a shift of one hours. For example, 1-2, 2-3,3-4,4-5 hour.
May someone help me here.
Thank you
2 Comments
Sara Boznik
on 14 Aug 2020
Maybe will be good if you send us the data.
If I correctly understand you, you need only the pick number like 1 2 3 and not 0.5, 1.5 ...
Some idea would be that you use
if rem(num,1)==0
For more I need your task.
Wish you best of luck.
Rafael Hernandez-Walls
on 14 Aug 2020
If you have this data,
n=10;
x=[1:n]';y=[1:n]';
% shift of one hours
[x(1:n-1) y(2:n)]
Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!