Need NaNs in data but not to be evaluated and keep then put back
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
James Tursa
on 6 Mar 2015
Edited: James Tursa
on 6 Mar 2015
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
See Also
Categories
Find more on Fuzzy Logic Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!