Remove NAN's from a matrix

11 ビュー (過去 30 日間)
HECTOR LUNA ENRIQUEZ
HECTOR LUNA ENRIQUEZ 2016 年 11 月 30 日
編集済み: KSSV 2016 年 11 月 30 日
i have the matrix: [5 4 3 2 1;Nan 4 3 2 1;Nan Nan 3 2 1] and i want to have [5 4 3 2 1; 4 3 2 1;3 2 1] How can i get that? or how can i separate the matrix in vectors and so delete de nan's? Tanks

回答 (1 件)

KSSV
KSSV 2016 年 11 月 30 日
編集済み: KSSV 2016 年 11 月 30 日
A = [5 4 3 2 1;NaN 4 3 2 1;NaN NaN 3 2 1] ;
idx = isnan(A) ;
A(idx) = 0 ;
You cannot get the result as [5 4 3 2 1; 4 3 2 1;3 2 1], because this is not a matrix. You can remove the nan's and replace with the number you want.

カテゴリ

Help Center および File ExchangeNaNs についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by