Can someone suggest me a trick to make this code faster.
"all_DOY" = 1000*15000*23 ; %(i,j,k) such that k dimension is the day of the year whic is random, while (i,j) are my pixel location starting from (1,1) to (1000,15000). The values of day of the year (DOY) in the kth dimension rranges range from -1 to 366
"all_variable" = 1000*15000*23; This is my variable value for (i,j,k) for the (i,j) position and k dimension i.e., day of the year in the "all_DOY" matrix. The values in the kth dimension range from -3000 to 15000
all_variable_new = 1000*15000*366
I'm trying to update the "all_variable_new" such that, my k dimension is from 1:366 (days of the year). for each day of the year obtained from "all_DOY" matrix, the variable value is updated in the "all_variable_new" for that respective (i,J,k) from "all_variable"
all_variable = load('all_variable.mat');
all_DOY = load('all_DOY.mat');
for ii =1: size(all_DOY,1)
for jj = 1:size(all_DOY,2)
idx = squeeze(all_DOY(ii,jj,:));
variable = squeeze(all_variable(ii,jj,:));
all_variable_new(ii,jj,:) = NaN;
for mm = Ind
all_variable_new(ii,jj,mm) = variable;
clear idx Ind mm