comparison of two column vectors
이전 댓글 표시
sir/madam i have two column vectors, i want to compare element by element and want to know which is large or small.
please help me, how can i write command for it.
답변 (1개)
An example
%%
v1 = rand( 6,1 );
v2 = rand( 6,1 );
%%
v1 > v2
This result tells us that the first, fourth, fifth and sixth element of v1 are larger than the corresponding elements of v2
댓글 수: 8
Image Analyst
2022년 4월 9일
@pramod kumar it would benefit you to invest two hours here:
after that you'll be able to answer questions like this, and many more, yourself.
Chaudhary P Patel
2022년 4월 15일
per isakson
2022년 4월 15일
I don't understand your comment.
Read if, elseif, else, Execute statements if condition is true and please notice: An expression is true when its result is nonempty and contains only nonzero elements (logical or real numeric).
Chaudhary P Patel
2022년 4월 16일
편집: per isakson
2022년 4월 17일
Chaudhary P Patel
2022년 4월 18일
per isakson
2022년 4월 18일
No it will not work. Why don't just try to run it?
Why do you have two for-loops. One should be enough.
In a statement like, for LV=v1<=v2, the expression, v1<=v2, must evaluate to a row. See help on for-else-end.
In the assignment, Fs=abc;, Fs is overwritten each time LV is false.
Chaudhary P Patel
2022년 4월 19일
Chaudhary P Patel
2022년 4월 19일
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!