フィルターのクリア

remove first value that appears after sequence of NaNs

1 回表示 (過去 30 日間)
MatLab Code N
MatLab Code N 2020 年 6 月 27 日
コメント済み: Star Strider 2020 年 6 月 29 日
Hi,
In my dataset, the first value that appears after a sequence of NaNs needs be removed. This removed value also need to be made NaN so that I dont consider in further anlaysis. I have attached the example dataset for your reference, I have colored some of those value to be removed in red.
I highly appreciate your help.
Thanks!
  2 件のコメント
madhan ravi
madhan ravi 2020 年 6 月 27 日
A short example would help.
MatLab Code N
MatLab Code N 2020 年 6 月 27 日
I have attached the excel file with example dataset

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2020 年 6 月 28 日
Try this:
D = readmatrix('example_data.xlsx');
R01 = strfind(isnan(D(:,1)).', [1 0]); % Find Indices Of [0 1] Transitions
Out = D; % Duplicate Original Matrix In 'Out'
Out(R01+1,:) = NaN; % Replace Appropriate Values With 'NaN'
This appears to do what you want on the rows that I checked. It assumes that the NaN values are the same rows in both columns, since they appear to be in the posted file. The ‘Out’ matrix is the output of the code.
.
  2 件のコメント
MatLab Code N
MatLab Code N 2020 年 6 月 29 日
Thanks it worked!
Star Strider
Star Strider 2020 年 6 月 29 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by