フィルターのクリア

Only Changing NaN values of a vector

4 ビュー (過去 30 日間)
Elizabeth Drybrugh
Elizabeth Drybrugh 2018 年 4 月 2 日
編集済み: Walter Roberson 2018 年 4 月 22 日
I want to access (202 elements) from vec A and check if isnan and change these but keep my normal values. Code to change all elements;
A = smooth(A, 'lowess'); %I want to change only NaNs
keepInA = zeros(size(all_behav(:,1))); %created new vec
for i = 1:size(A) %search 202 rows
mem = i(:,1) == isnan; %try find isnan ---- not working (showing 202 0s)
end
I haven't made much progress, pretty bad at loops any help appreciated

採用された回答

Elizabeth Drybrugh
Elizabeth Drybrugh 2018 年 4 月 22 日
編集済み: Walter Roberson 2018 年 4 月 22 日

I am not sure if I mentioned this but changing to 0 does not help as I am using N-1 cross validation and in the literature it is not regarded as a 'suitable' method of solving the problem.

https://uk.mathworks.com/matlabcentral/fileexchange/67013-dummy-rep-nan-x-?focused=9163520&tab=function

I created my own function to solve it which works by creating a dummy vector of the same size, std and mean to then replace NaN with acceptable values. Posting this for anyone who comes across this question in google.

Cheers, walter for a response

:)

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 4 月 2 日
A( isnan(A) ) = 0; %if you are changing them to 0.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by