MATLAB Answers

Division of two Multidimensional array

조회 수: 4(최근 30일)
mukesh bisht
mukesh bisht 2021년 7월 11일
댓글: mukesh bisht 2021년 7월 11일
Hi
I have two multidimensional array say A (30x10x30) & B(30x10x30). I want to divide the elements of A by the corresponding elements of B.
How to do it.
I am not getting corrrect result by diving like this A./B
  댓글 수: 6
mukesh bisht
mukesh bisht 2021년 7월 11일
Sorry. Now I got it. Actually in Matlab workspace A(7,1,1) shows 0.000. So, this created confusion

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

답변(1개)

LO
LO 2021년 7월 11일
편집: LO 2021년 7월 11일
you can iterate the 2D division
A = rand(30,10,30);
B = rand(30,10,30);
sz=size(A);
r = cell(sz(3),1);
for i = 1:sz(3)
r{i} = A(:,:,i)./B(:,:,i); % in this cell array you will have the divisions
end

Community Treasure Hunt

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

Start Hunting!

Translated by