How to determine connectivity with binary numbers?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Geoff
le 25 Avr 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 commentaires
Voir également
Catégories
En savoir plus sur Discrete Math dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!