how can i move the elements of a matrix with 1s and 0s?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Image Analyst
2016-5-5
编辑:Image Analyst
2016-5-5
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Gravitation, Cosmology & Astrophysics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!