how to find the difference between first column and second column in a cell array

1 回表示 (過去 30 日間)
I am a having cell
C=5x1 cell
which contains
10x2 double
10x2 double
10x2 double
10x2 double
10x2 double
I need to find the difference between first and second column of C. Could anyone please help me on it.

採用された回答

Simon Chan
Simon Chan 2021 年 7 月 18 日
cellfun(@(x) x(:,1)-x(:,2),C,'UniformOutput',false)
  5 件のコメント
jaah navi
jaah navi 2021 年 7 月 18 日
I used the command
D=cellfun(@(x) sum((x(:,1)-x(:,2)).^2)/10,C,'UniformOutput',false)
Now I want to sum D and divide by 5.
Could you please help me on this.
Simon Chan
Simon Chan 2021 年 7 月 18 日
mean(cell2mat(D))

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by