필터 지우기
필터 지우기

Finding coordinates for matrix from another matrix

조회 수: 1 (최근 30일)
Eric
Eric 2014년 12월 4일
답변: Andrew Newell 2014년 12월 4일
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

답변 (1개)

Andrew Newell
Andrew Newell 2014년 12월 4일
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

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by