MATLAB Answers

0

Calculate based on row

Asked by Setiadi Suriana on 15 Jul 2019
Latest activity Answered by Andrei Bobrov
on 15 Jul 2019
I have 4060x1 cells, and each cell has 11x1 matrix. I want each cell able to calculate with the formula: Row(i) - Row(i+1) and the row 11=0
Example from 1 of 4060 cells:
Row1: 2
Row2: 5
Row3: 8
Row4: 9
Row5: 12
Row6: 14
Row7: 14
Row8: 15
Row9: 15
Row10: 14
Row11: 14
Desired output:
Row1: -3
Row2: -3
Row3: -1
....
Row 11: 0
Thank you

  1 Comment

KSSV
on 15 Jul 2019
R{i}-R{i+1}
Run a loop......

Sign in to comment.

Products


Release

R2016a

1 Answer

Andrei Bobrov
Answer by Andrei Bobrov
on 15 Jul 2019
 Accepted Answer

out = cellfun(@(x)-diff(x),your_cell_array,'un',0);

  0 Comments

Sign in to comment.