MATLAB Answers

Subtract rows and Save the outputs in a new column

1 view (last 30 days)
Eslam Wafdy
Eslam Wafdy on 5 Feb 2021
Answered: madhan ravi on 5 Feb 2021
Hi every body,
I have a dataset excel CSV sheet with a three columns,(X,Y, and Z)
The first and second columns represents the coordinates of point, while the third one represents the elevations value of the point.
What i need is to subtract the first row from the second one and the second row from the third and the fourth from the fifth and the fifth from the sixth ….. etc. till the end of the data
The output should be saved on a fourth column (say output column)
And finally all the datasets to be saved to an excel file
Thanks A lot,

Answers (1)

madhan ravi
madhan ravi on 5 Feb 2021
Use readtable(), diff() and finally writetable().

Tags

Community Treasure Hunt

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

Start Hunting!