Removing Nans, converting matrix to vector
이전 댓글 표시
Hi
I have 50 x 60 x 45 double arrays, from which I want to remove the Nans, and, which I then want to convert into a (row or column) vector. I realized that the following line should do this (let C be my array):
C(isnan(C)) = [];
is this correct at all? How comes that with this line the matrix is also converted to a vector? Also, are the linear indices of the original matrix used to create the order of the elements in the row vector?
Many thanks
답변 (1개)
KSSV
2016년 6월 29일
Let C be you matrix of 50X60X45 matrix
C = C(:) ; % convert to column vector
C(isnan(C)) = [] ; % remove NaNs
카테고리
도움말 센터 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!