indexing - MATLAB correlation loop excluding specific column -


i'm trying write code perform correlation on data, each iteration exclude 1 specific column calculation. 1000x60x5 matrix , b 1000x1 vector. @ moment have

out(60,5)= zeros;  % preallocate loop output   ques=1:size(a,2)      rep=1:size(a,3)         out(ques,rep) = corr(a(:,[(1:ques-1):(ques+1:end)],rep),b(:),...         'rows','pairwise','type','spearman');     end     end 

is there way can specify (instead of [(1:ques-1):(ques+1:end)]) exclude ques column calculation?

i'm assuming way handling 3rd dimension have intended. think you've done fine here alternative won't error when ques == 1 or ques == size(a,2) yours will. on downside, might slower method, haven't tested it.

out(59,60,5)= zeros;  % preallocate loop output   ques=1:size(a,2)      rep=1:size(a,3)         cols = 1:size(a,2);         cols(ques) = [];         out(:,ques,rep) = corr(a(:, cols, rep),b,...         'rows','pairwise','type','spearman');     end     end 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -