Categorising coordinates into a table
이전 댓글 표시
Say I have cell column C of size (n,1), and in each entry are two row vectors A_i and B_i (for i=1,2,...,n) of the same length m which contain numbers. I want to create a table of the data according to which we scan each pair of vectors A_i and B_i and categorise them into the ranges Arange=[0,1,3,5,7,9,999] and Brange=[0,2,4,6,8,10,999], . So if A_3=4 and B_3=12, it would go into the table position (6,3). Ideally, each entry in the table would be a list of coordinates which I can use to get the total number of elements that fit into that particular coordinate in the table.
I can calculate the totals in a range for just one row vector A_i and one range Arange as shown in the attachment, but how I do extend this to two vectors and two ranges, and to get a list of coordinates rather than just the number of coordinates?
EDIT: attaching new file of data.
댓글 수: 4
dpb
2019년 2월 11일
Sounds like a binning problem from the choice of words but I can't quite make out what the actual input looks like nor the desired output...attach a small(ish) dataset that illustrates both inputs and the desired output(s)...
Sam Smith
2019년 2월 11일
dpb
2019년 2월 11일
>> cell2mat(C)
ans =
5.7000 2.9000 6.5000
1.1000 3.6000 2.8000
5.8000 0.5000 2.8000
7.4000 1.6000 0.8000
>> Arange=[0,1,3,999];
Brange=[0,2,4,999];
>> [Arange; Brange]
ans =
0 1 3 999
0 2 4 999
>> want=[1 1 1; 0 1 1; 0 0 1]
want =
1 1 1
0 1 1
0 0 1
>>
'Splain how you get want from the above dataset? C(1,1) (as well as several other elements) is greater than the bin limits shown. What does want really represent in your mind?
Sam Smith
2019년 2월 11일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!