How to determine connectivity with binary numbers?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am looking to optimize the material properties of a composite matrix made up of fibers and a matrix. One of the constraints are that the fibers must be connected. For example the following matrix shows fibers all connected to each other,
[1 1 2 2 2; 1 1 1 2 2; 2 1 1 1 2; 2 1 1 2 2; 2 2 2 2 2];
Where 1 is a fiber, and 2 is the matrix(epoxy) material.
Here is an example of an incorrect matrix that does not meet the constraints.
[1 2 2 2 2; 2 2 1 2 2; 2 2 2 2 1; 1 1 2 2 2; 2 2 2 2 2]; What function would be most useful to make a constraint, assuring the 1's are connected?
I tried to use the function bwlabel, but it seems to only work for "traditional" binary 0 and 1. I need to keep the numbers 1 and 2 for my problem. Is there a way to do this still?
0 comentarios
Respuestas (1)
Geoff
el 25 de Abr. de 2012
Yeah.
A = [1 2 2 2 2; 2 2 1 2 2; 2 2 2 2 1; 1 1 2 2 2; 2 2 2 2 2];
B = ~logical( A - 1 );
Now do your tests with B, leaving A unchanged.
2 comentarios
Ver también
Categorías
Más información sobre Discrete Math 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!