compare elements of a 2x1 column vector

1 Ansicht (letzte 30 Tage)
Jetty Rakesh Aditya
Jetty Rakesh Aditya am 24 Okt. 2020
Beantwortet: Ameer Hamza am 24 Okt. 2020
i have a cell c that has 2x1 column vectors as elements
c {1} = [1;0](say v1)
c{2} = [2;3](say v2)
now i want to compare the
elements of the vectors and store 1 if v(1) > v(2) and store 0 if v(1)<v(2)
how can i achieve this?

Antworten (1)

Ameer Hamza
Ameer Hamza am 24 Okt. 2020
You can directly make the comparison using the cell array
c{1} = [1;0];
c{2} = [2;3];
comp_result = c{1}(1) > c{2}(2);

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by