이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
How to average across tables in a cell
조회 수: 2 (최근 30일)
이전 댓글 표시
MH
2024년 8월 20일
I have a Cell containing a n number of tables (in this case 3 tables (2500x44)) and I'm trying output just one table being the average of each cell within each table across all 3 tables. This is likely a silly question but can't seem to figure it out.
채택된 답변
Matt J
2024년 8월 20일
편집: Matt J
2024년 8월 20일
AvgTb=Tb{1};
AvgTb{1}{:,:}=(Tb{1}{:,:}+Tb{2}{:,:}+Tb{3}{:,:})/3;
댓글 수: 7
MH
2024년 8월 20일
I think the first answer you posted worked better:
AvgTb=(Tb{1}{:,:}+Tb{2}{:,:}+Tb{3}{:,:})/3
Voss
2024년 8월 20일
% a cell array of random tables:
Tb = {array2table(rand(2500,44)),array2table(rand(2500,44)),array2table(rand(2500,44))}
Tb = 1x3 cell array
{2500x44 table} {2500x44 table} {2500x44 table}
% works for 3 tables:
AvgTb = Tb{1};
AvgTb{:,:} = (Tb{1}{:,:}+Tb{2}{:,:}+Tb{3}{:,:})/3
AvgTb = 2500x44 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 Var12 Var13 Var14 Var15 Var16 Var17 Var18 Var19 Var20 Var21 Var22 Var23 Var24 Var25 Var26 Var27 Var28 Var29 Var30 Var31 Var32 Var33 Var34 Var35 Var36 Var37 Var38 Var39 Var40 Var41 Var42 Var43 Var44
_______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ ________ _______ _______ _______ _______ ________ _______ _______ ________ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______
0.41018 0.73942 0.75333 0.37089 0.65434 0.53177 0.39299 0.22851 0.4474 0.3598 0.36524 0.36684 0.40242 0.57789 0.39719 0.68968 0.45027 0.64765 0.56051 0.41959 0.94093 0.58909 0.32647 0.6472 0.73271 0.55547 0.6697 0.69246 0.53041 0.4972 0.42411 0.5844 0.51137 0.47417 0.53614 0.4104 0.14948 0.5647 0.42496 0.48552 0.40118 0.59917 0.71337 0.52427
0.14625 0.62049 0.38215 0.61192 0.9119 0.16877 0.36206 0.75736 0.72875 0.65142 0.47544 0.30371 0.63133 0.25987 0.4659 0.71896 0.31596 0.62471 0.33404 0.55204 0.54006 0.59033 0.32402 0.26969 0.26417 0.45824 0.5535 0.44065 0.74227 0.47639 0.031314 0.31105 0.53081 0.50334 0.33234 0.61398 0.42435 0.5107 0.46942 0.51748 0.61489 0.72241 0.5352 0.68471
0.61117 0.55554 0.40714 0.69957 0.5719 0.2332 0.85054 0.63705 0.7635 0.26659 0.68455 0.37591 0.34929 0.52516 0.8473 0.3936 0.41448 0.34484 0.39946 0.51605 0.49188 0.34155 0.21404 0.81639 0.40714 0.19573 0.2826 0.26088 0.89449 0.77309 0.52789 0.55141 0.57312 0.36962 0.46113 0.57864 0.52626 0.6903 0.3979 0.5064 0.281 0.60981 0.38757 0.23151
0.80655 0.86216 0.61069 0.58464 0.56806 0.41743 0.39325 0.47526 0.45946 0.70663 0.38321 0.57171 0.35962 0.71325 0.36677 0.55735 0.54702 0.53974 0.33629 0.75002 0.50512 0.63104 0.45831 0.41343 0.24314 0.52055 0.55302 0.59641 0.51422 0.49438 0.30398 0.28199 0.4279 0.48247 0.46489 0.56095 0.42096 0.55489 0.45032 0.41091 0.6491 0.29014 0.26764 0.59205
0.5263 0.43493 0.54389 0.59291 0.48323 0.56195 0.88921 0.48622 0.36411 0.47256 0.52689 0.61859 0.32796 0.24255 0.35782 0.60564 0.40841 0.17112 0.56976 0.64655 0.5432 0.57277 0.61281 0.53251 0.66733 0.74055 0.31459 0.27146 0.49731 0.58267 0.76865 0.5442 0.54347 0.47073 0.53649 0.22501 0.53596 0.64551 0.76294 0.69777 0.23219 0.6809 0.22819 0.23632
0.62511 0.28488 0.23453 0.51797 0.30586 0.18732 0.35036 0.40713 0.34849 0.60591 0.6632 0.43047 0.69114 0.53629 0.32526 0.1568 0.34281 0.61046 0.47903 0.56441 0.36015 0.4012 0.28072 0.51984 0.74308 0.62125 0.63582 0.6332 0.54465 0.24939 0.40346 0.77085 0.4084 0.077406 0.52711 0.81296 0.60907 0.70195 0.61769 0.65101 0.49828 0.59644 0.50652 0.48286
0.51142 0.52435 0.57926 0.72648 0.49766 0.19274 0.27058 0.69889 0.78285 0.52241 0.51937 0.3901 0.36143 0.24075 0.59402 0.78392 0.17481 0.63167 0.67103 0.43562 0.41065 0.59386 0.20078 0.32767 0.62495 0.091331 0.40606 0.24044 0.56327 0.2433 0.48813 0.57734 0.23297 0.69404 0.49353 0.58204 0.32504 0.35426 0.66283 0.70051 0.78428 0.68649 0.61056 0.60774
0.2995 0.29105 0.44389 0.57486 0.49818 0.27361 0.82277 0.51306 0.6676 0.48763 0.33202 0.74754 0.43694 0.70606 0.76264 0.76668 0.42364 0.29358 0.6392 0.38075 0.58578 0.52549 0.56604 0.58609 0.34195 0.488 0.63713 0.67388 0.56812 0.34503 0.44394 0.19983 0.1842 0.61503 0.60597 0.40281 0.85872 0.44729 0.63509 0.50016 0.582 0.47943 0.19885 0.66562
0.34611 0.55968 0.40529 0.34645 0.61733 0.4991 0.54221 0.2185 0.47353 0.67039 0.59399 0.1841 0.66891 0.62888 0.66595 0.52772 0.58111 0.52604 0.41952 0.65328 0.49517 0.48237 0.43414 0.69885 0.30331 0.87899 0.39856 0.30253 0.32574 0.41372 0.61035 0.38418 0.52432 0.65296 0.42368 0.64212 0.47178 0.75127 0.21092 0.42787 0.41374 0.42477 0.54195 0.36743
0.34778 0.52862 0.52181 0.38321 0.58509 0.69441 0.44666 0.52103 0.63872 0.50766 0.69584 0.64504 0.44081 0.53274 0.45652 0.69224 0.31982 0.6544 0.27914 0.58148 0.59631 0.60967 0.88632 0.31471 0.59544 0.67917 0.2295 0.56721 0.51682 0.75379 0.34803 0.67598 0.60874 0.44662 0.61858 0.30958 0.45834 0.28833 0.48246 0.50508 0.36907 0.61835 0.46105 0.4191
0.59221 0.33425 0.65125 0.67478 0.4853 0.58019 0.66257 0.47645 0.47737 0.42759 0.58587 0.57074 0.52196 0.47703 0.56496 0.51824 0.44556 0.37325 0.64011 0.71505 0.45664 0.66861 0.49065 0.64353 0.5028 0.63506 0.4021 0.63628 0.73849 0.40156 0.5315 0.6206 0.48963 0.50556 0.49974 0.44193 0.63169 0.65845 0.63364 0.55791 0.52484 0.40741 0.4524 0.72361
0.50846 0.55697 0.438 0.71525 0.69028 0.65926 0.51628 0.55503 0.6258 0.73259 0.37386 0.65199 0.48715 0.3159 0.41424 0.43154 0.6881 0.79485 0.48753 0.14726 0.64054 0.60373 0.78254 0.72724 0.51263 0.65096 0.63688 0.60903 0.64775 0.31038 0.4911 0.41608 0.89316 0.38326 0.8915 0.40023 0.41579 0.5166 0.47783 0.43703 0.28541 0.55792 0.58423 0.74376
0.45525 0.58454 0.60338 0.74892 0.36026 0.89681 0.62396 0.51441 0.72619 0.84931 0.79881 0.64561 0.49029 0.54177 0.1488 0.19132 0.59873 0.31446 0.2433 0.54041 0.61139 0.30796 0.60919 0.56347 0.21933 0.48112 0.33004 0.34764 0.65427 0.88379 0.42359 0.85694 0.34943 0.74519 0.18742 0.40912 0.63561 0.69598 0.64795 0.33223 0.38946 0.57092 0.1982 0.18203
0.40297 0.53641 0.3893 0.2399 0.5897 0.59911 0.41139 0.2412 0.59667 0.43732 0.62795 0.26621 0.63151 0.41368 0.39882 0.78034 0.35524 0.57698 0.51876 0.34254 0.16938 0.43085 0.54164 0.71272 0.41585 0.40892 0.74227 0.71813 0.81753 0.46684 0.6166 0.55242 0.34844 0.63201 0.48164 0.50998 0.6269 0.17157 0.569 0.54441 0.46177 0.52922 0.44846 0.65083
0.46006 0.58045 0.76546 0.36849 0.16878 0.66709 0.29535 0.46633 0.2181 0.44468 0.49084 0.5505 0.28021 0.47382 0.46438 0.25973 0.58692 0.371 0.44672 0.47217 0.66126 0.47245 0.35134 0.52458 0.56202 0.65401 0.6475 0.48807 0.52398 0.46846 0.6874 0.49188 0.57354 0.44025 0.82396 0.4306 0.50339 0.37188 0.36597 0.47472 0.46956 0.77883 0.47229 0.70808
0.3829 0.26393 0.35905 0.51691 0.41563 0.52623 0.46331 0.4985 0.49866 0.63182 0.69798 0.68671 0.38473 0.12898 0.48083 0.58709 0.76036 0.49661 0.46583 0.73471 0.32702 0.50869 0.27947 0.69192 0.2006 0.47381 0.48907 0.48891 0.45724 0.34809 0.29188 0.24242 0.4348 0.29123 0.70982 0.25039 0.5995 0.383 0.49347 0.60466 0.33618 0.32151 0.42863 0.35373
% works for any number of tables > 0
AvgTb = Tb{1};
tmp = cellfun(@(t)t{:,:},Tb,'UniformOutput',false);
AvgTb{:,:} = mean(cat(3,tmp{:}),3)
AvgTb = 2500x44 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 Var12 Var13 Var14 Var15 Var16 Var17 Var18 Var19 Var20 Var21 Var22 Var23 Var24 Var25 Var26 Var27 Var28 Var29 Var30 Var31 Var32 Var33 Var34 Var35 Var36 Var37 Var38 Var39 Var40 Var41 Var42 Var43 Var44
_______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______ ________ _______ _______ _______ _______ ________ _______ _______ ________ _______ _______ _______ _______ _______ _______ _______ _______ _______ _______
0.41018 0.73942 0.75333 0.37089 0.65434 0.53177 0.39299 0.22851 0.4474 0.3598 0.36524 0.36684 0.40242 0.57789 0.39719 0.68968 0.45027 0.64765 0.56051 0.41959 0.94093 0.58909 0.32647 0.6472 0.73271 0.55547 0.6697 0.69246 0.53041 0.4972 0.42411 0.5844 0.51137 0.47417 0.53614 0.4104 0.14948 0.5647 0.42496 0.48552 0.40118 0.59917 0.71337 0.52427
0.14625 0.62049 0.38215 0.61192 0.9119 0.16877 0.36206 0.75736 0.72875 0.65142 0.47544 0.30371 0.63133 0.25987 0.4659 0.71896 0.31596 0.62471 0.33404 0.55204 0.54006 0.59033 0.32402 0.26969 0.26417 0.45824 0.5535 0.44065 0.74227 0.47639 0.031314 0.31105 0.53081 0.50334 0.33234 0.61398 0.42435 0.5107 0.46942 0.51748 0.61489 0.72241 0.5352 0.68471
0.61117 0.55554 0.40714 0.69957 0.5719 0.2332 0.85054 0.63705 0.7635 0.26659 0.68455 0.37591 0.34929 0.52516 0.8473 0.3936 0.41448 0.34484 0.39946 0.51605 0.49188 0.34155 0.21404 0.81639 0.40714 0.19573 0.2826 0.26088 0.89449 0.77309 0.52789 0.55141 0.57312 0.36962 0.46113 0.57864 0.52626 0.6903 0.3979 0.5064 0.281 0.60981 0.38757 0.23151
0.80655 0.86216 0.61069 0.58464 0.56806 0.41743 0.39325 0.47526 0.45946 0.70663 0.38321 0.57171 0.35962 0.71325 0.36677 0.55735 0.54702 0.53974 0.33629 0.75002 0.50512 0.63104 0.45831 0.41343 0.24314 0.52055 0.55302 0.59641 0.51422 0.49438 0.30398 0.28199 0.4279 0.48247 0.46489 0.56095 0.42096 0.55489 0.45032 0.41091 0.6491 0.29014 0.26764 0.59205
0.5263 0.43493 0.54389 0.59291 0.48323 0.56195 0.88921 0.48622 0.36411 0.47256 0.52689 0.61859 0.32796 0.24255 0.35782 0.60564 0.40841 0.17112 0.56976 0.64655 0.5432 0.57277 0.61281 0.53251 0.66733 0.74055 0.31459 0.27146 0.49731 0.58267 0.76865 0.5442 0.54347 0.47073 0.53649 0.22501 0.53596 0.64551 0.76294 0.69777 0.23219 0.6809 0.22819 0.23632
0.62511 0.28488 0.23453 0.51797 0.30586 0.18732 0.35036 0.40713 0.34849 0.60591 0.6632 0.43047 0.69114 0.53629 0.32526 0.1568 0.34281 0.61046 0.47903 0.56441 0.36015 0.4012 0.28072 0.51984 0.74308 0.62125 0.63582 0.6332 0.54465 0.24939 0.40346 0.77085 0.4084 0.077406 0.52711 0.81296 0.60907 0.70195 0.61769 0.65101 0.49828 0.59644 0.50652 0.48286
0.51142 0.52435 0.57926 0.72648 0.49766 0.19274 0.27058 0.69889 0.78285 0.52241 0.51937 0.3901 0.36143 0.24075 0.59402 0.78392 0.17481 0.63167 0.67103 0.43562 0.41065 0.59386 0.20078 0.32767 0.62495 0.091331 0.40606 0.24044 0.56327 0.2433 0.48813 0.57734 0.23297 0.69404 0.49353 0.58204 0.32504 0.35426 0.66283 0.70051 0.78428 0.68649 0.61056 0.60774
0.2995 0.29105 0.44389 0.57486 0.49818 0.27361 0.82277 0.51306 0.6676 0.48763 0.33202 0.74754 0.43694 0.70606 0.76264 0.76668 0.42364 0.29358 0.6392 0.38075 0.58578 0.52549 0.56604 0.58609 0.34195 0.488 0.63713 0.67388 0.56812 0.34503 0.44394 0.19983 0.1842 0.61503 0.60597 0.40281 0.85872 0.44729 0.63509 0.50016 0.582 0.47943 0.19885 0.66562
0.34611 0.55968 0.40529 0.34645 0.61733 0.4991 0.54221 0.2185 0.47353 0.67039 0.59399 0.1841 0.66891 0.62888 0.66595 0.52772 0.58111 0.52604 0.41952 0.65328 0.49517 0.48237 0.43414 0.69885 0.30331 0.87899 0.39856 0.30253 0.32574 0.41372 0.61035 0.38418 0.52432 0.65296 0.42368 0.64212 0.47178 0.75127 0.21092 0.42787 0.41374 0.42477 0.54195 0.36743
0.34778 0.52862 0.52181 0.38321 0.58509 0.69441 0.44666 0.52103 0.63872 0.50766 0.69584 0.64504 0.44081 0.53274 0.45652 0.69224 0.31982 0.6544 0.27914 0.58148 0.59631 0.60967 0.88632 0.31471 0.59544 0.67917 0.2295 0.56721 0.51682 0.75379 0.34803 0.67598 0.60874 0.44662 0.61858 0.30958 0.45834 0.28833 0.48246 0.50508 0.36907 0.61835 0.46105 0.4191
0.59221 0.33425 0.65125 0.67478 0.4853 0.58019 0.66257 0.47645 0.47737 0.42759 0.58587 0.57074 0.52196 0.47703 0.56496 0.51824 0.44556 0.37325 0.64011 0.71505 0.45664 0.66861 0.49065 0.64353 0.5028 0.63506 0.4021 0.63628 0.73849 0.40156 0.5315 0.6206 0.48963 0.50556 0.49974 0.44193 0.63169 0.65845 0.63364 0.55791 0.52484 0.40741 0.4524 0.72361
0.50846 0.55697 0.438 0.71525 0.69028 0.65926 0.51628 0.55503 0.6258 0.73259 0.37386 0.65199 0.48715 0.3159 0.41424 0.43154 0.6881 0.79485 0.48753 0.14726 0.64054 0.60373 0.78254 0.72724 0.51263 0.65096 0.63688 0.60903 0.64775 0.31038 0.4911 0.41608 0.89316 0.38326 0.8915 0.40023 0.41579 0.5166 0.47783 0.43703 0.28541 0.55792 0.58423 0.74376
0.45525 0.58454 0.60338 0.74892 0.36026 0.89681 0.62396 0.51441 0.72619 0.84931 0.79881 0.64561 0.49029 0.54177 0.1488 0.19132 0.59873 0.31446 0.2433 0.54041 0.61139 0.30796 0.60919 0.56347 0.21933 0.48112 0.33004 0.34764 0.65427 0.88379 0.42359 0.85694 0.34943 0.74519 0.18742 0.40912 0.63561 0.69598 0.64795 0.33223 0.38946 0.57092 0.1982 0.18203
0.40297 0.53641 0.3893 0.2399 0.5897 0.59911 0.41139 0.2412 0.59667 0.43732 0.62795 0.26621 0.63151 0.41368 0.39882 0.78034 0.35524 0.57698 0.51876 0.34254 0.16938 0.43085 0.54164 0.71272 0.41585 0.40892 0.74227 0.71813 0.81753 0.46684 0.6166 0.55242 0.34844 0.63201 0.48164 0.50998 0.6269 0.17157 0.569 0.54441 0.46177 0.52922 0.44846 0.65083
0.46006 0.58045 0.76546 0.36849 0.16878 0.66709 0.29535 0.46633 0.2181 0.44468 0.49084 0.5505 0.28021 0.47382 0.46438 0.25973 0.58692 0.371 0.44672 0.47217 0.66126 0.47245 0.35134 0.52458 0.56202 0.65401 0.6475 0.48807 0.52398 0.46846 0.6874 0.49188 0.57354 0.44025 0.82396 0.4306 0.50339 0.37188 0.36597 0.47472 0.46956 0.77883 0.47229 0.70808
0.3829 0.26393 0.35905 0.51691 0.41563 0.52623 0.46331 0.4985 0.49866 0.63182 0.69798 0.68671 0.38473 0.12898 0.48083 0.58709 0.76036 0.49661 0.46583 0.73471 0.32702 0.50869 0.27947 0.69192 0.2006 0.47381 0.48907 0.48891 0.45724 0.34809 0.29188 0.24242 0.4348 0.29123 0.70982 0.25039 0.5995 0.383 0.49347 0.60466 0.33618 0.32151 0.42863 0.35373
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)