Difference between columns, fixed the first column, in a matrix
조회 수: 4 (최근 30일)
이전 댓글 표시
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!