Need NaNs in data but not to be evaluated and keep then put back

1 次查看(过去 30 天)
I have snippet of my matrix: [NaN NaN 6.67 NaN NaN NaN NaN NaN NaN NaN 5.49 NaN NaN 6.5 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 5.31 6.85]
[data] = xlsread('datafile');
set = (data(:,2));
DO = ((set)- min(set)) / ( max(set) - min(set) );
DO(isnan(DO)) = [];
fis = readfis('Group1');
Group_1=evalfis([DO],fis);
I am using FIS to analyze the data and I need to keep the NaNs. My final result uses multiple inputs from different parameters for final output. Some sections I have missing parameters. The formula is supposed to provide analysis answer regardless of missing information. FIS substitutes default answers for NaNs. I need to graph this outcome at the end.
So, how can I ask in a coding method for analysis of just the values and not NaNs, but keep the NaNs in the end as matrix integrity. Sort of like here are the values analyse them only and put back into correct place?
Thanks!

回答(1 个)

James Tursa
James Tursa 2015-3-6
编辑:James Tursa 2015-3-6
Keep track of the isnan locations, and use that to put the results in the proper element locations. E.g., assuming Group_1 is the same size as DO (is this true?)
DO = ((set)- min(set)) / ( max(set) - min(set) );
ix = isnan(DO); % Remember the isnan locations
DN = DO; % Remember the full array
DO(ix) = []; % Get rid of the NaN's in DO
fis = readfis('Group1');
Group_1=evalfis([DO],fis); % Call the function for the non-NaN's
DN(~ix) = Group_1; % Put the results back into the full array
  1 个评论
Sasha K
Sasha K 2015-3-7
James thank you!
It isn't quite what I need. Is there a way like a "loop" command that asks FIS to just take the matrix size as is, but not evaluate the NaNs? Keep the size integrity the same?
Sort of going into FIS as 34 x 1 and evaluated the values only, without NaNs, directly? Kind of telling the FIS to ignore the NaNs.
Sorry if it was unclear before.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Fuzzy Logic Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by