Matrix element comparision ?

1 Ansicht (letzte 30 Tage)
anshuman mishra
anshuman mishra am 13 Dez. 2019
Beantwortet: Fangjun Jiang am 13 Dez. 2019
i have a matrix:
3 0
1 2
1 4
i can find the smallest element in 1st column i.e. 1 & 0 in the second column.
I need to assign a variable as 0 for each multiple similar element in a single column i.e 1 & 1 in the 1st column & assign 1 to only one unique element in single column i.e 0 in 2nd column.
  3 Kommentare
anshuman mishra
anshuman mishra am 13 Dez. 2019
Bearbeitet: anshuman mishra am 13 Dez. 2019
i mean to say lets take a variable v.
Then required answer would be v =0 1 ( 0 as in multiple similar element in a single column i.e 1 & 1 in the 1st column & 1 to only one unique element in single column i.e 0 in 2nd column.
anshuman mishra
anshuman mishra am 13 Dez. 2019
Sorry i typed traversal instead of element. My bad :)

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 13 Dez. 2019
V=[3 0;1 2;1 4];
out=sum(M==min(M))==1

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by