How to repeat the condition for two matrices having different sizes?

I have two matrices of two different sizes A (61 x 61 x 1085) & B (61 x 61 x 31)
I apply my conditions to first A(61 x 61 x 31) until it reaches to the size of B.
Now I want to repeat the same conditions for next A (61 x 61 x 32:62) until it reaches to the size of B....and so on...upto A(61 x 61 x 1085).
Anyone, thanks in advance.

댓글 수: 5

What does "applying a condition" mean? You want to repeat which same condition? Why "32:62"? Please edit the question and explain the details.
I try to accurate it.
So I have two matrices A [61,61,1085] and B [61,61,31] and I need to check if the elements in A are greater than the elements in B at the iteration of size of B.
thanks Jan
So you can compare the first block A(:, :, 1:31) with B. You get a logical 3D array as output, which contains a TRUE, if the element is greater. What do you want to do with the result? Do you want an all() or any()? Then how to proceed for the rest of A? 1085 is not a multiple of 31. Please explain exactly, what you want to achieve. The less the readers have to guess, the more likey is a useful answer.
Dear Jan, my apologies
Actually I want to check if the elements of A are greater than elements in B.
So we can compare the first block A(:, :, 31) with B and get a logical 3D array as output and it stores it in a matrix. Now program should check it for the second block A(:,:,32:63) with B again, and stores it in outputs......and so on..
Result should have the dimension as of A (61,61,1085).
thank you
I fixed my answer.

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

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2019년 4월 25일
편집: Andrei Bobrov 2019년 4월 26일

1 개 추천

I edited the answer.
out = A > B(:,:,mod(0:size(A,3)-1,size(B,3))+1);

댓글 수: 3

Thank you for giving response dear Andrei Bobrov.
It is not helping.
Can we do this without using reshape?
The final result also coming different.
What should be the end result?
Please give an example.
Thank you Andrei Bobrov...It worked well...

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

질문:

2019년 4월 25일

댓글:

2019년 4월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by