Azzera filtri
Azzera filtri

Finding coordinates for matrix from another matrix

1 visualizzazione (ultimi 30 giorni)
Eric
Eric il 4 Dic 2014
Risposto: Andrew Newell il 4 Dic 2014
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

Risposte (1)

Andrew Newell
Andrew Newell il 4 Dic 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

Categorie

Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by