Difference between columns, fixed the first column, in a matrix
4 ビュー (過去 30 日間)
古いコメントを表示
Montserrat Vallcorba Martí
2017 年 11 月 3 日
コメント済み: Montserrat Vallcorba Martí
2017 年 11 月 3 日
Hi, I have a 3D-matrix and I want to calculate differences between columns, fixed the first column, and the value be positive or zero, i.e., for each 3D dimension calculate: max ( column(i)-column(1), 0 ). For example:

Thank you in advance!
0 件のコメント
採用された回答
その他の回答 (1 件)
Andrei Bobrov
2017 年 11 月 3 日
編集済み: Andrei Bobrov
2017 年 11 月 3 日
B = bsxfun(@minus,A(:,2:end,:),A(:,1,:));
B(B<0) = 0;
参考
カテゴリ
Help Center および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!