How to calculate the area in table and certain coordinate
2 ビュー (過去 30 日間)
古いコメントを表示
Area Centroid
____ ________________
9 147.67 109.11
27 146.81 108.52
43 147.09 109.7
54 147.81 109.35
12 146.17 134.42
56 147.73 109.46
21 146.48 134.05
53 147.83 109.26
20 147.3 134.25
2 126.5 146
43 147.67 108.63
24 147 134.04
2 126.5 146
45 147.93 108.87
20 147.25 133.95
10 125.5 146.8
37 147.43 108.89
16 147.31 133.56
6 126.17 147
36 147.39 108.81
12 147.92 133.75
6 126.5 147
34 147.32 108.91
12 147.92 133.75
8 126.5 146
29 147.69 109
13 147.54 133.38
8 126.5 146
28 147.71 109.11
7 148.14 134.43
8 126.5 146
28 147.71 109.11
6 148 134.5
7 126.43 145.71
28 147.71 109.11
7 147.29 133.71
1 106 132
8 126.25 145.5
25 147.4 109.08
7 147.29 133.71
1 106 132
5 126.4 145.2
31 147.03 108.87
9 147.33 133.78
2 105.5 132
6 126.17 145
31 147.03 108.87
9 147.33 133.78
1 106 132
3 125.67 144.33
31 147.03 108.87
9 147.33 133.78
31 147.03 108.87
9 147.33 133.78
28 147.43 109.39
10 146.7 133.6
25 147.08 109.4
11 147.55 133.18
28 147.43 109.39
5 146.8 133.2
20 147.7 109.55
3 149 132
12 147.92 109.33
Hi all, I have data above.Anyone know how to calculate the total are ? Let say Inwant calculate the the total are that have coordinate (147 109) and (146 108), is it like this the command sum([146:147 108:109])?
0 件のコメント
採用された回答
C B
2021 年 10 月 3 日
編集済み: C B
2021 年 10 月 3 日
Hello @mohd akmal masud, You need to take out Area index then sum it where centroid is within you range.
You can do that like following
Area = [9;27;43];
Centroid = [146.67 108.11; 146.81 109.52; 146.09 108.7];
T = table(Area ,Centroid);
%check in all value which are 147 in column 1 and 109 in column 2
trueIndex = ((147>=T.Centroid(:,1) & T.Centroid(:,1)>=146)&(109>=T.Centroid(:,2) & T.Centroid(:,2)>=108));
%add all area which have 147 and 109
sum(Area(trueIndex))
Or in one liner if you want
sum(Area(((147>=T.Centroid(:,1) & T.Centroid(:,1)>=146)&(109>=T.Centroid(:,2) & T.Centroid(:,2)>=108))))
Please mark answer as accepted if it satisfies your requirement.
13 件のコメント
C B
2021 年 10 月 13 日
in this case there are 2 area what do you want with them 1st one or second or sum?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!