how can i move the elements of a matrix with 1s and 0s?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, so i have a 288x180 matrix with 1s and 0s which was randomly assigned to each of its subpixel. now i need to create a movement of the values in such a way that all the 1s will move towards each other, that is, each value of 0s and 1s will swap continuosly until all the 1s gather in one particular part of the matrix.
P.S: i have taken 1 a pure value indicating presence of a class and 0 as an impure value. Pls help me with the code. i have tried manual assignment of the values but am not getting the required results. Thanks in advance.
0 commentaires
Réponses (1)
Image Analyst
le 5 Mai 2016
Modifié(e) : Image Analyst
le 5 Mai 2016
I'd treat each 1 as a planet, or a charged particle, and compute the gravitational or electrical force on each particle. Then move the particle in the direction of the net force on that particle. Repeat until all particles are at the same location. Shouldn't be too hard. Give it a try.
0 commentaires
Voir également
Catégories
En savoir plus sur Gravitation, Cosmology & Astrophysics 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!