Read vector until last value, or NANs start
4 ビュー (過去 30 日間)
古いコメントを表示
I have a vector array with an unknown number of entries. Either it will end nicely with the last entry being a number, or nans will start populating. I just need the index of the last actual number, not knowing if there's a next entry, or if the next is a nan.
Can you help?
Thanks!
0 件のコメント
採用された回答
Walter Roberson
2018 年 7 月 8 日
lastidx = find(isnan(YourVector),1) - 1;
if isempty(lastidx); lastidx = length(YourVector); end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!