Sort an array logical like a stair
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello everyone,
I got a simple problem and I thought maybe there is already a function in MATLAB I could use. I got an array like in the picture and I want to sort the values like the route from the red line.
At the end I want a 1xN array.
Do somebody know how to sort them easily like this ?
Thanks!
<<
>>
댓글 수: 2
Jan
2018년 10월 1일
There are 3 red lines, therefore it is not uniquely clear, what you want as output. Is it wanted, that on the right middle part, the 0.6286 is not included, but the NaN above is?
답변 (3개)
Bruno Luong
2018년 10월 1일
If you have Image Proc TBX, you can use
watershed
regionprops
on the logical array
isnan(A)
댓글 수: 2
Bruno Luong
2018년 10월 1일
No, just don't quite understand how you can get a stair boundaries in general, and why there is no branch. So I give you a generic tool that handle all situations.
Benutzer Name
2018년 10월 2일
댓글 수: 4
Stephen23
2018년 10월 2일
" In my array you can see the following path (at least a human)"
But we need an algorithm, if you want this written in any kind of code.
Bruno Luong
2018년 10월 2일
"This is how:"
Good luck for you to find someone who can solve your human problem.
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!