Finding coordinates for matrix from another matrix
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NaNs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!