How to subtract one cell with previous cell in the table in matlab and do it consecutively until the last row?
1 回表示 (過去 30 日間)
古いコメントを表示
Kasih Ditaningtyas Sari Pratiwi
2017 年 11 月 4 日
コメント済み: Kasih Ditaningtyas Sari Pratiwi
2017 年 11 月 5 日
Hi! I need your help. Actually I can do this in excel, but I am curious about how to do it in Matlab. I attach the picture in excel about the mathematical operation I want to do. I want to calculate the duration in minutes by substracting one cell with previous cell and multiply it by 24*60. I also want to do it consecutively until the last row. Do you know how to do it with matlab code? Suppose I have a table with three variables, the first one for duration, the second one for rainfall intensity (mm/min) and the third one for the duration (minutes) which I want to calculate. Could you please help me? Thank you very much in advance.
採用された回答
Image Analyst
2017 年 11 月 4 日
diff() will give you the difference between rows of each column in your table, t. For example:
dDate = diff(t.Dates);
dt = diff(t.Rainfall);
dd = diff(t.duration);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!