Take a difference between the value and the lagged value dealing with NaN

2 views (last 30 days)
Suppose I have a table T such as
Running Dist Swimming Dist
---------------------------------------------
Jan 18 100 10
Feb 18 80 NaN
Mar 18 105 12
I want to take n-month changes of Running distance and Swimming distance. (But skips when there are NaN.)
In case of n=1, it will be
Running Dist Swimming Dist
---------------------------------------------
Feb 18 -20 NaN
Mar 18 +25 NaN
Please advise.
  1 Comment
Paolo
Paolo on 14 Jun 2018
Edited: Paolo on 14 Jun 2018
What's the expected output for n = 2?
What about this table
Running Dist Swimming Dist
---------------------------------------------
Jan 18 100 10
Feb 18 80 NaN
Mar 18 105 12
Apr 18 60 NaN
?

Sign in to comment.

Answers (1)

Sindhu Yerragunta
Sindhu Yerragunta on 18 Jun 2018
Hi Alpedhuez,
One suggestion would be cleaning your data before you calculate the difference. The following link elaborates on how to clean and standardize the missing data.
Hope this information helps.
-Sindhu

Categories

Find more on Genomics and Next Generation Sequencing in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!