how i can find the Union of a particular Binary array???

10 visualizaciones (últimos 30 días)
Jack
Jack el 27 de En. de 2016
Editada: Jack el 2 de Feb. de 2016
hello
i have a matrix of 0 and 1 (binary matrix) for example:
A=
[001010
101101
110010].
so how to find the union of this matrix? what is the mathematical rules of union for binary matrix?
Definition of Union: if any body study mathematics in school, may you could see a lesson about the union between sets, for example: we have set A=[1,2,2,3]and set B=[2,3,3,2] then if we ask what is the union between set A and set B? Answer : A U B = [1,2,3]. the symbol "U" means union in mathematics. (free lesson) i wish it is clear.
  2 comentarios
Star Strider
Star Strider el 27 de En. de 2016
What do you consider ‘union’?
What result do you want?
Image Analyst
Image Analyst el 27 de En. de 2016

Here's the Union Jack:

Sorry, it was a pun too irresistible to avoid.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 27 de En. de 2016
If have
A = [0 0 1 0 1 0
1 0 1 1 0 1
1 1 0 0 1 0]
and you want the union along the vertical axis, giving a 6 bit result, then use
any(A)
  4 comentarios
Image Analyst
Image Analyst el 28 de En. de 2016
Walter's solution gives [1;1;1]. Jack still hasn't defined union. Jack, please say how you are getting (mentally) [1;1;0] from that array? Especially puzzling is how the third row is a zero. Please explain.
Guillaume
Guillaume el 28 de En. de 2016
Editada: Guillaume el 28 de En. de 2016
Possibly, the operation is an inverted XOR, which could be obtained with:
~mod(sum(A, 2), 2)

Iniciar sesión para comentar.

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by