Removing NaN row from matrix
古いコメントを表示
Hi, i have a huge time series where the whole first vertical row is NaN. I'm totally new to Matlab but i need to erase the whole row or convert all NaN to 0. If anyone can give me a step by step guide for dummies on how to do this it would be much appreciated.
回答 (1 件)
Geoff Hayes
2017 年 11 月 8 日
Audun - by vertical row do you mean a column? If you want to remove the first column from your matrix, then you could do something like
A = randi(255,4,5); % test matrix with four rows and five columns
A = A(:,2:end); % remove the first column of A
A = randi(255,4,5);
A(:,1) = NaN;
A(isnan(A)) = 0;
2 件のコメント
Peder Tannlege
2017 年 11 月 8 日
Geoff Hayes
2017 年 11 月 8 日
Peder - the A matrix is just an example. I use randi to generate a 4x5 matrix of integers from 1 to 255. Your matrix would be named and populated in some other manner...
カテゴリ
ヘルプ センター および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!