Borrar filtros
Borrar filtros

Finding coordinates for matrix from another matrix

1 visualización (últimos 30 días)
Eric
Eric el 4 de Dic. de 2014
Respondida: Andrew Newell el 4 de Dic. de 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

Respuestas (1)

Andrew Newell
Andrew Newell el 4 de Dic. de 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

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by