Calculate based on row

조회 수: 3 (최근 30일)
Setiadi Suriana
Setiadi Suriana 2019년 7월 15일
답변: Andrei Bobrov 2019년 7월 15일
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
KSSV
KSSV 2019년 7월 15일
R{i}-R{i+1}
Run a loop......

댓글을 달려면 로그인하십시오.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2019년 7월 15일
out = cellfun(@(x)-diff(x),your_cell_array,'un',0);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by