Using diff(x) function to create a new table by subtracting values from the previous row
이전 댓글 표시
I was trying to create a new table from a set of data that I have. I've attached the dataset to this question and a picture so I can explain what I want to do.

Using this data, I want to first eliminate all the empty boxes (NaNs in matlab) so that the data stacks directly on top of itself. For example, here is an example using a small subset of data.

Now using this data, what I want to do is create a new table that subtracts values of one row from the PREVIOUS row and puts them into a new spot an array. For example, for the previous dataset:

From what I have read so far, I believe the best function to use is the diff(x) documentation but I haven't been able to figure out how to implement the values I receive from it and put them into a new array
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!