MATLAB: 2D subtraction from 3D array substraction I have 3D matrix A=50x60x180 and I want subtract B=50×60 to get same size C=50x50x180? Can anybody use for loop to do this operation? Best Answer C = A - B;orC = bsxfun(@minus,A,B); Related SolutionsMATLAB: Divide a 3D matrix into smaller 3D matrixes YourCell = mat2cell(size(YourArray,1), size(YourArray,2), 4*ones(size(YourArray,3)/4)); MATLAB: Vectorisation of 2 2d matrix For MATLAB versions R2016b+:C = A - reshape(B,1,1,[])For earlier versions:C = bsxfun(@minus,A,reshape(B,1,1,[])) Related QuestionCreate a 3D Martix by operation of 1D vector on 2D matrix, using cat()4-D
Best Answer