3rd dimension data from each pixel to column-wise

조회 수: 12 (최근 30일)
Haa Andrew
Haa Andrew 2017년 10월 2일
댓글: Andrei Bobrov 2017년 10월 2일
I have 3D matrix of 80x100x27. Third dimnesion contains my required data. I want to extract each pixel value from third dimension (1x1x27) and place that in and place that in column (27x1). I want to do it for all data. So I will be having 8000 columns and 27 rows (27x8000). But some pixels in 3rd-dimension are totally NaN, if values are NaN, I don't want to include those columns. Please also show how to remove NaN values. Thanks

채택된 답변

Andrei Bobrov
Andrei Bobrov 2017년 10월 2일
편집: Andrei Bobrov 2017년 10월 2일
Let A - your array [80x100x27]
[m,n,k] = size(A);
B = reshape(permute(A,[3,1,2]),k,[]);
out = B(:,all(~isnan(B)));
  댓글 수: 2
Haa Andrew
Haa Andrew 2017년 10월 2일
But this results in 8000x1. While I need it in 27x8000.
Andrei Bobrov
Andrei Bobrov 2017년 10월 2일
fixed

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by