Hello! Thank you for reading my question!
I have a dataset that is the following:
DO_data_and_quality =
[226051x10 double] [226051x1 double] {226051x1 cell} {226051x1 cell}
First: station name, second:datenum, third: dissolve oxygen measurements (has NaN because of missing fields due to spacing or missed measurement), fourth: error code in the form of the following:
Primary objective: Remove the a row that has NaN, for all of the cell objects. Secondary objective: To group the error codes into their own cells, with the corresponding row of the other cells
*Code for primary objective:
Flag_DO=NDBCdata.F_DO_mgl;
rawDO=NDBCdata.DO_mgl;
fh1 = @(x)isnan(x(:));
whereNaN_Flag_DO=cellfun(fh1, Flag_DO,'UniformOutput',false);
whereNaN_DO=cellfun(fh1, raw_DO,'UniformOutput',false);
raw_DO=NDBCdata.DO_mgl;
fh2=@(x)(x(whereNaN_DO ==1 | whereNaN_Flag_DO ==1));
DO_data_and_quality={ NDBCdata.ID_num NDBCdata.DateNUM raw_DO Flag_DO};
DO_data_and_quality(cellfun(fh2, DO_data_and_quality)) = [];
I am not using indexing correctly, may I have a few pointers?
Even more stangely when I click on the problem line in the error msg I get: Undefined function or variable 'whereNaN_DO'.
I did a whos whereNaN_DO and I get an output! Name Size Bytes Class Attributes
whereNaN_DO 226051x1 25543763 cell
*For secondary objective
I was going use: codeFlag_DO=cellfun(@double,Flag_DO, 'UniformOutput', false); and use a similar indexing method where I would select the second term or the last few terms if there is a 3 letter error code.
Thanks!