I search for indices in one matrix with double zeros and then replace them in another two matricies with NA. However, because there are 400,000 rows and 400,000 columns, the replacement is slow. Is there a better/faster way to do this. Here is the sample code:
[rows,cols,~] = find(binZ); % indices to elements with double-zeros
rrr(rows,cols) = NaN; % replace double-zeros with NaN's %%%%%%This step is slow %%%
RRR(rows,cols) = NaN; % replace double-zeros with NaN's %%%%%%This step is slow %%%
Best Answer