Finding coordinates for matrix from another matrix

2 views (last 30 days)
Hi,
I'm trying to find the coordinates of specific values in a 4-D matrix from a list of values. The 4D matrix is (3x2x17x17) and I have a list (23x1) with values that I would like to find the coordinates for in the 4D matrix.
ValsPure = ValsScore(3,2,:,:);
Sig_pval5 = AllTablesPure(AllTablesPure<0.05);
Sig_pval10 = AllTablesPure(AllTablesPure<0.1);
unique_sig_pval5 = unique(Sig_pval5);
for iiil = 1:length(unique_sig_pval5)
a = unique_sig_pval5(iiil,1);
[ii,jj]=find(a, AllTablesPure);
out=[ii jj]
end
I've been trying in different ways to figure this out but I keep getting errors.
Thank you very much in advance.
Best regards,
Christian

Answers (1)

Andrew Newell
Andrew Newell on 4 Dec 2014
I will assume that you want four-dimensional coordinates and that you want all the matches for each value. I suggest replacing
[ii,jj]=find(a, AllTablesPure);
out=[ii jj]
by
ii = find(a,AllTablesPure);
for jj = ii
out = ind2sub(size(allTablesPure),jj)
end

Categories

Find more on Resizing and Reshaping Matrices 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!