Binary matrix to array of poitns
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I have a binary image (only 0 and 1) and I want to convert it to x-y arrays.
For example:
Matrix
0 1 0 1
0 0 0 1
1 0 0 0
0 0 0 0
Obtain:
x = [1 1 2 3];
y = [2 4 4 1];
I can do it with two loops, but I'm finding something more fast. Thanks
댓글 수: 0
채택된 답변
추가 답변 (1개)
CS Researcher
2016년 5월 4일
Do the x and y arrays have to be in that order? If not, you can do this:
[x,y] = find(A>0);
댓글 수: 0
참고 항목
카테고리
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!