Find borders of a truth map
Ältere Kommentare anzeigen
Hi,
I have an array
truth_map =
[0 0 0 0 0 0 0 0 1 1 ;
0 0 0 0 0 0 0 0 1 1 ;
0 0 0 0 0 0 0 1 1 1 ;
0 0 0 0 0 0 1 1 1 0 ;
0 0 0 0 0 1 1 1 1 0 ;
0 1 1 1 1 0 0 0 0 0 ;
1 1 1 1 1 0 0 0 0 0 ;
1 1 1 1 1 0 0 0 0 0 ;
1 1 1 1 0 0 0 0 0 0 ;
1 1 1 0 0 0 0 0 0 0 ; ]

Which I want to make look like this:
truth_map =
[0 0 0 0 0 0 0 0 1 0 ;
0 0 0 0 0 0 0 0 1 0 ;
0 0 0 0 0 0 0 1 0 1 ;
0 0 0 0 0 0 1 0 1 0 ;
0 0 0 0 0 1 1 1 1 0 ;
0 1 1 1 1 0 0 0 0 0 ;
1 0 0 0 1 0 0 0 0 0 ;
0 0 0 0 1 0 0 0 0 0 ;
0 0 0 1 0 0 0 0 0 0 ;
0 0 1 0 0 0 0 0 0 0 ; ]

This is trivial to do by hand for small arrays but my array is 1000x1000 and the area's are randomly shaped.
What would be a good way to just get an array of the borders?
Thanks, Daniel
Akzeptierte Antwort
Weitere Antworten (1)
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!