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!
0 个评论
回答(1 个)
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fuzzy Logic Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!