MATLAB Answers

use of for loop for time shift

6 views (last 30 days)
aa on 14 Aug 2020
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


Sara Boznik
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
Rafael Hernandez-Walls on 14 Aug 2020
If you have this data,
% shift of one hours
[x(1:n-1) y(2:n)]

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!