문제

I have a 3d matrix of 100x100x100. Each point of that matrix has assigned a value that corresponds to a certain signal strength. If I plot all the points the result is incomprehensible and requires horsepower to compute, due to the large amount of points that are painted. The next picture examplify the problem (in that case the matrix was 50x50x50 for reducing the computation time):

enter image description here

[x,y,z] = meshgrid(1:50,1:50,1:50);
scatter3(x(:),y(:),z(:),5,strength(:),'filled')

I would like to plot only the highest values (for example, the top 10). How can I do it?

One simple solution that came up in my mind is to asign "nan" to the values higher than the treshold. Even the results are nice I think that it must be a most elegant solution to fix it. enter image description here

도움이 되었습니까?

해결책

Reshape it into an nx1 vector. Sort that vector and take the first ten values.

num_of_rows = size(M,1)
V = reshape(M,num_of_rows,1); 
sorted_V = sort(V,'descend');
ind = sorted_V(1:10)

I am assuming that M is your 3D matrix. This will give you your top ten values in your matrix and the respective index. The you can use ind2sub() to get the x,y,z.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top