comparison of two column vectors
Show older comments
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.
Answers (1)
per isakson
on 9 Apr 2022
Edited: per isakson
on 9 Apr 2022
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 Comments
Image Analyst
on 9 Apr 2022
@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
on 15 Apr 2022
per isakson
on 15 Apr 2022
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
on 16 Apr 2022
Edited: per isakson
on 17 Apr 2022
Chaudhary P Patel
on 18 Apr 2022
per isakson
on 18 Apr 2022
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
on 19 Apr 2022
Chaudhary P Patel
on 19 Apr 2022
Categories
Find more on Graphics Performance in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!