이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

could anyone help me to solve my question

조회 수: 1(최근 30일)
jaah navi
jaah navi 2019년 5월 12일
마감: MATLAB Answer Bot 2021년 8월 20일
As i am unable to get the answer i am asking it again.
I am having two matrices A=[0.6399 0.8965] and B=[ 0.7684 0.0120;
0.5333 0.9666;
0.0684 0.8322;
0.1996 0.4453]
of different sizes generated in my code.
when size(A) is lesser than size(B) i done with the following command line
the code executes and gives me the result.
As A and B are generated by the code,sometimes size(A) is greater than size(B) so i have used the following command line
the code executes and gives me the result.
As i doesnt know whether size(A) is greater or lesser than size(B) i need to use the above code 1 and code 2 together by using if condition.
Could anyone help me how to use if condition with respect to code 1 and code 2.


gonzalo Mier
gonzalo Mier 2019년 5월 12일
You don't need if here. You can mix them as:
C = B;
len_A = min(size(B,1),size(A,1));
C(1:len_A,:) = C(1:len_A,:) - A(1:len_A,:);
  댓글 수: 1
gonzalo Mier
gonzalo Mier 2019년 5월 13일
If this answer helps you, please accept it :)


Community Treasure Hunt

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

Start Hunting!

Translated by