How to find number of counts for atoms (each minor grid) within XY grid?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello everyone, I have ID, type and XYZ coordinates of atoms within a box (as attached 1_aniline_epoxy_inftrated_ID_type_XYZ_data.txt data and image). Box is transformed in to number of XY grids or rectangle. I want to count number of atoms belong to each rectangle and want to plot number of counts into XY plot. Data and figure is attached.
Thank you,
Ankit
댓글 수: 0
채택된 답변
Star Strider
2023년 1월 6일
I am not certain what you want.
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1254562/1_aniline_epoxy_inftrated_ID_type_XYZ_data.txt');
T1.Properties.VariableNames = {'ID','Type','X','Y','Z'}
figure
scatter3(T1.X, T1.Y, T1.Z, 15, T1.Type, 'filled')
xlabel('X')
ylabel('Y')
zlabel('Z')
title('3D Scatterplot Of Data')
axis('equal')
colormap(turbo(numel(unique(T1.Type))))
title('3D Scatterplot Of Data')
figure
hh3 = histogram2(T1.X, T1.Y, 10);
hh3.FaceColor = 'flat';
colormap(turbo)
xlabel('X')
ylabel('Y')
zlabel('Z')
title('2D Histogram Of Data')
gethh3 = get(hh3); % Handle To Function
% Vals = hh3.Values % Same Matrix As 'Counts' Here
Counts = hh3.BinCounts
.
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!