Matrix element comparision ?

4 次查看(过去 30 天)
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 个评论
anshuman mishra
anshuman mishra 2019-12-13
编辑:anshuman mishra 2019-12-13
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 2019-12-13
Sorry i typed traversal instead of element. My bad :)

请先登录,再进行评论。

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by