Borrar filtros
Borrar filtros

how to omitt columns with only nan values when calculating means across mutiple tables?

9 visualizaciones (últimos 30 días)
Hi all,
I have a 21x1 cell with 100x 18 tables
I am calcuating mean of:
row 1, column1, all tables
row 2, column1, all tables
....
row 100, column 1, all tables
I repeat for remaining 17 columns, so ultimately, I have a table 100x18.
table=zeros(100,18);
for k=1:18
table_mean=table+table2array(my cell{k});
end
table_mean= table_mean/18
Howewever, some of the columns in a few tables have only 'nan' values. Is there a way to omitt those columns in my calculations?

Respuesta aceptada

Voss
Voss el 16 de Mzo. de 2022
Editada: Voss el 17 de Mzo. de 2022
This omits all NaNs from the mean calculation.
load('mycell.mat');
n_tables = numel(t_sq_dot_1);
% put all tables' data into a 3D array: 100x18x21
all_data = zeros([size(t_sq_dot_1{1}),n_tables]);
for ii = 1:n_tables
all_data(:,:,ii) = table2array(t_sq_dot_1{ii});
end
% alternate approach, using cellfun() and {:,:} indexing instead of
% a for loop and table2array():
% all_data = cellfun(@(x)x{:,:},t_sq_dot_1,'UniformOutput',false);
% all_data = cat(3,all_data{:});
% take the mean along the 3rd dimension, omitting NaNs
table_mean = mean(all_data,3,'omitnan');
disp(table_mean)
3.2692 -0.1068 0.1464 0.7062 0.4809 -0.3743 2.0286 0.0392 -0.0006 -35.7761 -52.0503 -2.1355 104.9331 -115.2761 21.4521 91.4996 -63.4170 -65.3826 3.1748 -0.0976 0.1587 0.7196 0.4482 -0.3933 2.0285 0.0363 -0.0197 -35.8181 -51.9571 -2.1162 105.0116 -115.1692 21.5113 90.4465 -66.4467 -65.0551 3.0639 -0.0934 0.1688 0.7253 0.4156 -0.4115 2.0091 0.0294 -0.0340 -35.8540 -51.8641 -2.0990 105.0953 -115.0492 21.5671 89.3639 -69.3250 -64.6531 2.9216 -0.0976 0.1762 0.7191 0.3847 -0.4285 1.9559 0.0161 -0.0412 -35.8832 -51.7764 -2.0856 105.1878 -114.9003 21.6147 88.2254 -71.9573 -64.1058 2.7413 -0.1107 0.1815 0.7018 0.3569 -0.4450 1.8654 -0.0026 -0.0414 -35.9080 -51.7029 -2.0770 105.2896 -114.7116 21.6488 87.0266 -74.2891 -63.3745 2.5242 -0.1300 0.1859 0.6781 0.3340 -0.4632 1.7438 -0.0219 -0.0368 -35.9287 -51.6560 -2.0734 105.3982 -114.4770 21.6643 85.7804 -76.2993 -62.4511 2.2775 -0.1503 0.1900 0.6543 0.3198 -0.4851 1.6021 -0.0362 -0.0301 -35.9440 -51.6492 -2.0742 105.5081 -114.1939 21.6566 84.5093 -78.0121 -61.3473 2.0111 -0.1669 0.1949 0.6343 0.3197 -0.5117 1.4510 -0.0426 -0.0236 -35.9527 -51.6945 -2.0782 105.6120 -113.8618 21.6217 83.2380 -79.4918 -60.0837 1.7356 -0.1771 0.2024 0.6194 0.3364 -0.5416 1.2996 -0.0409 -0.0193 -35.9546 -51.8000 -2.0844 105.7019 -113.4806 21.5566 81.9892 -80.8130 -58.6806 1.4603 -0.1821 0.2144 0.6081 0.3674 -0.5726 1.1542 -0.0323 -0.0186 -35.9514 -51.9691 -2.0923 105.7712 -113.0491 21.4591 80.7822 -82.0368 -57.1537 1.1922 -0.1852 0.2325 0.5981 0.4069 -0.6020 1.0172 -0.0184 -0.0232 -35.9454 -52.2015 -2.1019 105.8159 -112.5650 21.3268 79.6326 -83.2024 -55.5129 0.9350 -0.1892 0.2577 0.5863 0.4484 -0.6276 0.8891 -0.0009 -0.0342 -35.9391 -52.4950 -2.1135 105.8349 -112.0246 21.1578 78.5527 -84.3308 -53.7626 0.6888 -0.1943 0.2900 0.5713 0.4858 -0.6496 0.7697 0.0181 -0.0516 -35.9345 -52.8463 -2.1263 105.8294 -111.4245 20.9502 77.5519 -85.4294 -51.9042 0.4515 -0.1991 0.3276 0.5530 0.5139 -0.6699 0.6562 0.0365 -0.0735 -35.9332 -53.2509 -2.1389 105.8013 -110.7622 20.7035 76.6383 -86.4958 -49.9382 0.2220 -0.2015 0.3667 0.5307 0.5314 -0.6897 0.5445 0.0524 -0.0975 -35.9362 -53.7029 -2.1486 105.7513 -110.0366 20.4191 75.8177 -87.5197 -47.8662 0.0007 -0.1993 0.4030 0.5024 0.5409 -0.7074 0.4310 0.0655 -0.1232 -35.9437 -54.1943 -2.1525 105.6792 -109.2484 20.1000 75.0939 -88.4864 -45.6928 -0.2110 -0.1914 0.4309 0.4662 0.5471 -0.7185 0.3143 0.0787 -0.1518 -35.9558 -54.7148 -2.1484 105.5837 -108.4003 19.7503 74.4686 -89.3799 -43.4264 -0.4131 -0.1783 0.4444 0.4218 0.5543 -0.7168 0.1946 0.0962 -0.1819 -35.9715 -55.2547 -2.1359 105.4634 -107.4964 19.3736 73.9416 -90.1876 -41.0799 -0.6065 -0.1632 0.4398 0.3709 0.5631 -0.6970 0.0741 0.1194 -0.2066 -35.9896 -55.8071 -2.1162 105.3178 -106.5424 18.9728 73.5120 -90.9028 -38.6694 -0.7921 -0.1497 0.4173 0.3156 0.5694 -0.6573 -0.0449 0.1442 -0.2167 -36.0088 -56.3692 -2.0914 105.1478 -105.5444 18.5498 73.1787 -91.5252 -36.2141 -0.9706 -0.1394 0.3810 0.2560 0.5650 -0.5969 -0.1627 0.1630 -0.2044 -36.0279 -56.9404 -2.0639 104.9559 -104.5091 18.1074 72.9405 -92.0596 -33.7341 -1.1432 -0.1307 0.3365 0.1898 0.5401 -0.5151 -0.2845 0.1690 -0.1662 -36.0460 -57.5209 -2.0362 104.7463 -103.4439 17.6495 72.7965 -92.5134 -31.2496 -1.3105 -0.1209 0.2884 0.1149 0.4885 -0.4111 -0.4190 0.1593 -0.1045 -36.0629 -58.1095 -2.0102 104.5248 -102.3575 17.1815 72.7452 -92.8964 -28.7796 -1.4702 -0.1085 0.2408 0.0310 0.4122 -0.2860 -0.5704 0.1338 -0.0280 -36.0790 -58.7026 -1.9870 104.2984 -101.2600 16.7104 72.7827 -93.2199 -26.3409 -1.6153 -0.0935 0.1968 -0.0600 0.3199 -0.1465 -0.7337 0.0945 0.0502 -36.0954 -59.2943 -1.9668 104.0751 -100.1621 16.2434 72.9023 -93.4954 -23.9496 -1.7365 -0.0765 0.1577 -0.1530 0.2218 -0.0064 -0.8952 0.0450 0.1153 -36.1138 -59.8795 -1.9496 103.8633 -99.0751 15.7867 73.0949 -93.7336 -21.6210 -1.8243 -0.0576 0.1215 -0.2394 0.1250 0.1189 -1.0393 -0.0085 0.1542 -36.1364 -60.4558 -1.9352 103.6697 -98.0092 15.3451 73.3504 -93.9446 -19.3700 -1.8721 -0.0362 0.0840 -0.3110 0.0322 0.2225 -1.1517 -0.0564 0.1605 -36.1657 -61.0235 -1.9236 103.4961 -96.9731 14.9217 73.6562 -94.1386 -17.2099 -1.8783 -0.0110 0.0414 -0.3634 -0.0571 0.3121 -1.2205 -0.0902 0.1390 -36.2049 -61.5829 -1.9141 103.3384 -95.9735 14.5187 73.9969 -94.3259 -15.1515 -1.8472 0.0197 -0.0074 -0.3971 -0.1460 0.4032 -1.2398 -0.1082 0.1053 -36.2561 -62.1331 -1.9062 103.1896 -95.0169 14.1382 74.3538 -94.5152 -13.2044 -1.7873 0.0563 -0.0627 -0.4160 -0.2365 0.5047 -1.2126 -0.1180 0.0783 -36.3206 -62.6721 -1.8989 103.0437 -94.1102 13.7826 74.7089 -94.7122 -11.3772 -1.7072 0.0968 -0.1236 -0.4247 -0.3277 0.6112 -1.1497 -0.1298 0.0737 -36.3976 -63.1968 -1.8916 102.8986 -93.2612 13.4553 75.0483 -94.9181 -9.6788 -1.6112 0.1378 -0.1886 -0.4268 -0.4173 0.7071 -1.0653 -0.1502 0.0978 -36.4849 -63.7036 -1.8842 102.7565 -92.4777 13.1600 75.3655 -95.1306 -8.1176 -1.4997 0.1759 -0.2556 -0.4241 -0.5056 0.7760 -0.9735 -0.1805 0.1452 -36.5795 -64.1889 -1.8766 102.6219 -91.7659 12.8997 75.6614 -95.3460 -6.7010 -1.3706 0.2077 -0.3235 -0.4171 -0.5967 0.8065 -0.8833 -0.2187 0.1989 -36.6778 -64.6491 -1.8687 102.5005 -91.1304 12.6756 75.9424 -95.5583 -5.4333 -1.2215 0.2297 -0.3910 -0.4053 -0.6929 0.7958 -0.7931 -0.2640 0.2357 -36.7752 -65.0793 -1.8595 102.3968 -90.5728 12.4868 76.2181 -95.7598 -4.3132 -1.0518 0.2391 -0.4543 -0.3852 -0.7896 0.7540 -0.6950 -0.3182 0.2380 -36.8661 -65.4735 -1.8471 102.3129 -90.0929 12.3305 76.4982 -95.9423 -3.3343 -0.8679 0.2362 -0.5078 -0.3523 -0.8745 0.7025 -0.5836 -0.3807 0.2059 -36.9456 -65.8258 -1.8300 102.2484 -89.6883 12.2034 76.7887 -96.0982 -2.4864 -0.6846 0.2244 -0.5461 -0.3062 -0.9339 0.6641 -0.4617 -0.4425 0.1589 -37.0114 -66.1327 -1.8088 102.2018 -89.3552 12.1021 77.0871 -96.2226 -1.7592 -0.5208 0.2089 -0.5659 -0.2519 -0.9582 0.6498 -0.3400 -0.4866 0.1211 -37.0645 -66.3942 -1.7860 102.1735 -89.0890 12.0236 77.3823 -96.3139 -1.1444 -0.3916 0.1942 -0.5674 -0.1979 -0.9435 0.6545 -0.2332 -0.4979 0.1027 -37.1078 -66.6135 -1.7649 102.1659 -88.8845 11.9657 77.6605 -96.3737 -0.6374 -0.3037 0.1829 -0.5548 -0.1517 -0.8905 0.6615 -0.1546 -0.4718 0.0945 -37.1444 -66.7953 -1.7477 102.1812 -88.7368 11.9269 77.9116 -96.4061 -0.2364 -0.2558 0.1755 -0.5355 -0.1170 -0.8040 0.6518 -0.1075 -0.4162 0.0801 -37.1771 -66.9442 -1.7351 102.2181 -88.6405 11.9068 78.1329 -96.4168 0.0610 -0.2414 0.1712 -0.5175 -0.0931 -0.6940 0.6156 -0.0834 -0.3464 0.0502 -37.2071 -67.0636 -1.7264 102.2704 -88.5897 11.9050 78.3258 -96.4121 0.2595 -0.2514 0.1690 -0.5058 -0.0779 -0.5773 0.5581 -0.0703 -0.2770 0.0060 -37.2333 -67.1557 -1.7207 102.3295 -88.5783 11.9212 78.4906 -96.3983 0.3677 -0.2748 0.1677 -0.5011 -0.0700 -0.4749 0.4948 -0.0612 -0.2172 -0.0465 -37.2535 -67.2216 -1.7168 102.3881 -88.6002 11.9543 78.6247 -96.3796 0.3954 -0.3010 0.1678 -0.5018 -0.0675 -0.4047 0.4405 -0.0554 -0.1731 -0.1007 -37.2657 -67.2622 -1.7145 102.4421 -88.6508 12.0024 78.7248 -96.3584 0.3530 -0.3210 0.1712 -0.5063 -0.0685 -0.3741 0.4040 -0.0529 -0.1498 -0.1490 -37.2694 -67.2786 -1.7141 102.4919 -88.7267 12.0635 78.7905 -96.3362 0.2497 -0.3291 0.1794 -0.5142 -0.0724 -0.3820 0.3893 -0.0520 -0.1495 -0.1829 -37.2662 -67.2715 -1.7165 102.5416 -88.8269 12.1356 78.8262 -96.3136 0.0930 -0.3236 0.1923 -0.5246 -0.0809 -0.4222 0.3972 -0.0495 -0.1695 -0.1951 -37.2589 -67.2409 -1.7222 102.5986 -88.9531 12.2181 78.8386 -96.2906 -0.1132 -0.3078 0.2088 -0.5367 -0.0944 -0.4858 0.4255 -0.0445 -0.2024 -0.1857 -37.2503 -67.1860 -1.7306 102.6701 -89.1090 12.3113 78.8332 -96.2648 -0.3695 -0.2888 0.2267 -0.5501 -0.1111 -0.5613 0.4676 -0.0407 -0.2387 -0.1659 -37.2421 -67.1052 -1.7397 102.7601 -89.2998 12.4168 78.8121 -96.2310 -0.6811 -0.2746 0.2432 -0.5642 -0.1285 -0.6364 0.5111 -0.0445 -0.2703 -0.1496 -37.2346 -66.9954 -1.7467 102.8676 -89.5310 12.5368 78.7739 -96.1834 -1.0573 -0.2716 0.2557 -0.5771 -0.1452 -0.6993 0.5429 -0.0611 -0.2928 -0.1420 -37.2276 -66.8532 -1.7490 102.9872 -89.8078 12.6731 78.7148 -96.1173 -1.5096 -0.2861 0.2637 -0.5862 -0.1615 -0.7425 0.5551 -0.0933 -0.3064 -0.1363 -37.2200 -66.6752 -1.7456 103.1114 -90.1344 12.8264 78.6311 -96.0290 -2.0502 -0.3257 0.2682 -0.5878 -0.1797 -0.7638 0.5477 -0.1408 -0.3152 -0.1211 -37.2104 -66.4597 -1.7371 103.2346 -90.5146 12.9965 78.5208 -95.9154 -2.6908 -0.3989 0.2704 -0.5787 -0.2020 -0.7647 0.5267 -0.2012 -0.3265 -0.0924 -37.1970 -66.2069 -1.7253 103.3554 -90.9516 13.1824 78.3850 -95.7723 -3.4412 -0.5109 0.2708 -0.5573 -0.2289 -0.7498 0.5010 -0.2731 -0.3451 -0.0591 -37.1787 -65.9178 -1.7125 103.4761 -91.4485 13.3825 78.2276 -95.5935 -4.3087 -0.6580 0.2693 -0.5237 -0.2576 -0.7249 0.4765 -0.3578 -0.3695 -0.0354 -37.1552 -65.5930 -1.7010 103.6009 -92.0082 13.5959 78.0539 -95.3692 -5.2978 -0.8252 0.2647 -0.4790 -0.2841 -0.6962 0.4551 -0.4565 -0.3932 -0.0288 -37.1280 -65.2332 -1.6932 103.7330 -92.6324 13.8214 77.8691 -95.0847 -6.4096 -0.9921 0.2534 -0.4253 -0.3062 -0.6681 0.4372 -0.5676 -0.4109 -0.0359 -37.1003 -64.8393 -1.6910 103.8726 -93.3215 14.0587 77.6780 -94.7201 -7.6426 -1.1432 0.2313 -0.3646 -0.3243 -0.6399 0.4229 -0.6872 -0.4184 -0.0494 -37.0767 -64.4124 -1.6955 104.0172 -94.0738 14.3081 77.4841 -94.2504 -8.9926 -1.2729 0.1971 -0.2982 -0.3386 -0.6038 0.4102 -0.8091 -0.4093 -0.0630 -37.0608 -63.9530 -1.7066 104.1634 -94.8854 14.5707 77.2902 -93.6481 -10.4530 -1.3832 0.1525 -0.2267 -0.3479 -0.5488 0.3932 -0.9220 -0.3793 -0.0716 -37.0540 -63.4614 -1.7236 104.3092 -95.7509 14.8476 77.0966 -92.8889 -12.0154 -1.4769 0.1011 -0.1516 -0.3520 -0.4686 0.3638 -1.0127 -0.3312 -0.0734 -37.0553 -62.9382 -1.7463 104.4547 -96.6632 15.1392 76.8983 -91.9600 -13.6691 -1.5543 0.0483 -0.0755 -0.3526 -0.3655 0.3158 -1.0732 -0.2704 -0.0744 -37.0635 -62.3857 -1.7758 104.6021 -97.6143 15.4442 76.6860 -90.8726 -15.4024 -1.6111 0.0008 -0.0020 -0.3500 -0.2475 0.2468 -1.1048 -0.1955 -0.0870 -37.0775 -61.8094 -1.8132 104.7541 -98.5961 15.7602 76.4519 -89.6713 -17.2037 -1.6393 -0.0380 0.0656 -0.3401 -0.1243 0.1580 -1.1143 -0.1016 -0.1167 -37.0974 -61.2180 -1.8585 104.9123 -99.6002 16.0835 76.1946 -88.4315 -19.0628 -1.6303 -0.0706 0.1253 -0.3158 -0.0039 0.0541 -1.1041 0.0056 -0.1514 -37.1239 -60.6221 -1.9096 105.0763 -100.6185 16.4105 75.9187 -87.2404 -20.9705 -1.5770 -0.1023 0.1750 -0.2725 0.1091 -0.0567 -1.0696 0.1084 -0.1692 -37.1571 -60.0316 -1.9627 105.2431 -101.6431 16.7379 75.6327 -86.1675 -22.9191 -1.4782 -0.1352 0.2134 -0.2120 0.2143 -0.1664 -1.0049 0.1894 -0.1571 -37.1959 -59.4535 -2.0139 105.4081 -102.6673 17.0631 75.3498 -85.2407 -24.9014 -1.3393 -0.1675 0.2403 -0.1407 0.3128 -0.2691 -0.9078 0.2436 -0.1224 -37.2377 -58.8910 -2.0604 105.5664 -103.6859 17.3840 75.0882 -84.4369 -26.9099 -1.1711 -0.1950 0.2582 -0.0634 0.4040 -0.3560 -0.7832 0.2777 -0.0854 -37.2793 -58.3445 -2.1012 105.7134 -104.6935 17.6990 74.8671 -83.6928 -28.9344 -0.9847 -0.2156 0.2715 0.0186 0.4833 -0.4148 -0.6440 0.3012 -0.0595 -37.3178 -57.8130 -2.1364 105.8456 -105.6837 18.0075 74.7003 -82.9311 -30.9622 -0.7894 -0.2297 0.2848 0.1054 0.5461 -0.4375 -0.5027 0.3179 -0.0414 -37.3515 -57.2951 -2.1660 105.9612 -106.6481 18.3095 74.5941 -82.0940 -32.9802 -0.5913 -0.2395 0.3022 0.1954 0.5951 -0.4286 -0.3608 0.3275 -0.0195 -37.3799 -56.7903 -2.1901 106.0602 -107.5769 18.6048 74.5517 -81.1642 -34.9775 -0.3939 -0.2457 0.3256 0.2841 0.6360 -0.4029 -0.2102 0.3296 0.0098 -37.4039 -56.3002 -2.2087 106.1441 -108.4605 18.8910 74.5796 -80.1583 -36.9459 -0.1983 -0.2468 0.3537 0.3653 0.6662 -0.3798 -0.0470 0.3233 0.0360 -37.4249 -55.8286 -2.2220 106.2149 -109.2902 19.1634 74.6902 -79.0993 -38.8777 -0.0029 -0.2410 0.3816 0.4340 0.6755 -0.3743 0.1196 0.3072 0.0465 -37.4446 -55.3810 -2.2303 106.2734 -110.0591 19.4167 74.9003 -77.9959 -40.7644 0.1960 -0.2302 0.4015 0.4882 0.6599 -0.3898 0.2722 0.2807 0.0393 -37.4646 -54.9632 -2.2340 106.3174 -110.7625 19.6471 75.2259 -76.8463 -42.5957 0.4006 -0.2193 0.4042 0.5292 0.6263 -0.4182 0.3977 0.2459 0.0217 -37.4852 -54.5808 -2.2337 106.3427 -111.3975 19.8540 75.6782 -75.6525 -44.3614 0.6099 -0.2114 0.3833 0.5604 0.5859 -0.4463 0.4931 0.2070 0.0021 -37.5058 -54.2384 -2.2302 106.3440 -111.9628 20.0395 76.2613 -74.4303 -46.0540 0.8198 -0.2044 0.3389 0.5839 0.5467 -0.4629 0.5655 0.1687 -0.0167 -37.5249 -53.9392 -2.2246 106.3167 -112.4575 20.2077 76.9723 -73.2081 -47.6699 1.0257 -0.1943 0.2777 0.5963 0.5096 -0.4647 0.6258 0.1336 -0.0369 -37.5422 -53.6837 -2.2185 106.2587 -112.8832 20.3622 77.8045 -72.0137 -49.2106 1.2229 -0.1797 0.2106 0.5915 0.4695 -0.4555 0.6806 0.1012 -0.0613 -37.5595 -53.4707 -2.2135 106.1716 -113.2444 20.5051 78.7506 -70.8566 -50.6805 1.4075 -0.1634 0.1473 0.5686 0.4211 -0.4401 0.7293 0.0682 -0.0877 -37.5795 -53.2972 -2.2107 106.0600 -113.5490 20.6360 79.8015 -69.7271 -52.0858 1.5797 -0.1490 0.0955 0.5344 0.3653 -0.4209 0.7694 0.0323 -0.1070 -37.6042 -53.1594 -2.2105 105.9297 -113.8065 20.7536 80.9418 -68.6086 -53.4324 1.7438 -0.1383 0.0601 0.4980 0.3095 -0.3977 0.8057 -0.0031 -0.1068 -37.6341 -53.0526 -2.2127 105.7862 -114.0260 20.8562 82.1477 -67.4884 -54.7259 1.9067 -0.1304 0.0427 0.4657 0.2629 -0.3697 0.8513 -0.0303 -0.0795 -37.6682 -52.9708 -2.2168 105.6345 -114.2154 20.9432 83.3907 -66.3584 -55.9704 2.0727 -0.1239 0.0407 0.4394 0.2325 -0.3380 0.9183 -0.0439 -0.0298 -37.7053 -52.9072 -2.2218 105.4783 -114.3812 21.0155 84.6448 -65.2132 -57.1678 2.2413 -0.1183 0.0481 0.4197 0.2199 -0.3073 1.0090 -0.0440 0.0275 -37.7442 -52.8548 -2.2266 105.3208 -114.5286 21.0752 85.8877 -64.0516 -58.3175 2.4093 -0.1133 0.0582 0.4098 0.2222 -0.2822 1.1134 -0.0343 0.0762 -37.7846 -52.8081 -2.2303 105.1646 -114.6619 21.1251 87.0984 -62.8839 -59.4164 2.5734 -0.1079 0.0664 0.4140 0.2356 -0.2647 1.2181 -0.0202 0.1075 -37.8272 -52.7634 -2.2321 105.0128 -114.7838 21.1687 88.2519 -61.7408 -60.4591 2.7319 -0.1011 0.0707 0.4346 0.2579 -0.2549 1.3162 -0.0077 0.1208 -37.8733 -52.7197 -2.2314 104.8700 -114.8953 21.2089 89.3138 -60.6817 -61.4388 2.8837 -0.0938 0.0718 0.4692 0.2881 -0.2525 1.4117 -0.0010 0.1196 -37.9251 -52.6775 -2.2273 104.7417 -114.9950 21.2477 90.2420 -59.7960 -62.3476 3.0263 -0.0899 0.0714 0.5134 0.3238 -0.2580 1.5151 0.0009 0.1072 -37.9867 -52.6370 -2.2188 104.6334 -115.0799 21.2866 90.9950 -59.1945 -63.1772 3.1558 -0.0933 0.0720 0.5629 0.3620 -0.2726 1.6360 0.0031 0.0861 -38.0642 -52.5970 -2.2055 104.5488 -115.1464 21.3269 91.5463 -58.9852 -63.9216 3.2693 -0.1053 0.0759 0.6153 0.4018 -0.2973 1.7777 0.0107 0.0587 -38.1653 -52.5553 -2.1878 104.4879 -115.1922 21.3695 91.8970 -59.2324 -64.5828 3.3678 -0.1240 0.0841 0.6684 0.4444 -0.3316 1.9365 0.0249 0.0270 -38.2939 -52.5105 -2.1672 104.4460 -115.2189 21.4149 92.0849 -59.9050 -65.1755 3.4565 -0.1459 0.0958 0.7209 0.4899 -0.3716 2.1040 0.0434 -0.0065 -38.4418 -52.4636 -2.1453 104.4149 -115.2336 21.4620 92.1795 -60.8427 -65.7262
  5 comentarios
Voss
Voss el 18 de Mzo. de 2022
When I do that, I get a different error:
load('mycell.mat');
n_tables = numel(t_sq_dot_1);
nr = size(t_sq_dot_1{1},1);
% put all tables' data into a 3D array: 100x18x21
all_data = cellfun(@(x)x{:,:},t_sq_dot_1,'UniformOutput',false);
all_data = cat(3,all_data{:});
% set all elements in any column of all_data to NaN when any element in
% that column is NaN:
all_data(repmat(any(isnan(all_data),1),nr,1,1)) = NaN;
% take the std along the 3rd dimension, omitting NaNs
try
table_std = std(all_data,3,'omitnan');
catch ME
disp(ME.message);
table_std = std(all_data,0,3,'omitnan'); % the correct way to use std here
end % error message below:
W must be a vector of nonnegative weights, or a scalar 0 or 1.
disp(table_std)
2.5063 0.5033 0.4007 0.4030 0.3889 0.5161 1.2073 0.2481 0.3426 36.1457 14.1200 4.2527 11.1760 8.9321 6.2287 28.5125 40.9769 11.6152 2.4250 0.4690 0.3895 0.3634 0.3374 0.4807 1.1897 0.2303 0.3407 36.1971 14.0396 4.2329 11.1754 8.9061 6.1924 27.2196 36.2983 11.4415 2.3705 0.4511 0.3938 0.3421 0.3329 0.4750 1.1650 0.2410 0.3636 36.2345 13.9602 4.2108 11.1799 8.8803 6.1561 25.9954 32.8555 11.2494 2.3358 0.4450 0.4030 0.3349 0.3636 0.4873 1.1203 0.2698 0.3906 36.2548 13.8710 4.1854 11.1911 8.8505 6.1164 24.7941 30.6037 11.0170 2.3219 0.4432 0.4099 0.3358 0.4129 0.5025 1.0574 0.3006 0.4110 36.2635 13.7630 4.1581 11.2094 8.8136 6.0716 23.5923 29.1638 10.7458 2.3352 0.4396 0.4163 0.3410 0.4699 0.5094 0.9897 0.3244 0.4200 36.2677 13.6315 4.1321 11.2326 8.7684 6.0210 22.3962 28.0882 10.4558 2.3784 0.4309 0.4271 0.3476 0.5240 0.5028 0.9316 0.3413 0.4168 36.2731 13.4776 4.1102 11.2579 8.7152 5.9642 21.2404 27.0572 10.1751 2.4434 0.4170 0.4426 0.3520 0.5651 0.4835 0.8902 0.3536 0.4042 36.2833 13.3087 4.0941 11.2832 8.6566 5.9009 20.1760 25.9451 9.9284 2.5109 0.4009 0.4557 0.3497 0.5870 0.4579 0.8618 0.3608 0.3850 36.2994 13.1376 4.0844 11.3083 8.5973 5.8307 19.2535 24.7554 9.7323 2.5563 0.3863 0.4593 0.3374 0.5898 0.4346 0.8357 0.3623 0.3607 36.3206 12.9784 4.0796 11.3348 8.5437 5.7531 18.5076 23.5202 9.5961 2.5579 0.3760 0.4542 0.3152 0.5799 0.4203 0.8024 0.3597 0.3354 36.3447 12.8418 4.0772 11.3650 8.5027 5.6677 17.9485 22.2447 9.5237 2.5053 0.3705 0.4489 0.2908 0.5649 0.4177 0.7596 0.3560 0.3162 36.3687 12.7316 4.0739 11.4007 8.4804 5.5752 17.5642 20.9054 9.5149 2.4037 0.3695 0.4517 0.2792 0.5490 0.4248 0.7146 0.3530 0.3092 36.3899 12.6448 4.0671 11.4416 8.4810 5.4769 17.3273 19.4759 9.5651 2.2694 0.3720 0.4659 0.2949 0.5328 0.4374 0.6812 0.3496 0.3130 36.4066 12.5744 4.0554 11.4857 8.5051 5.3751 17.2029 17.9519 9.6658 2.1215 0.3763 0.4901 0.3418 0.5165 0.4558 0.6732 0.3417 0.3188 36.4183 12.5135 4.0380 11.5300 8.5500 5.2729 17.1541 16.3634 9.8065 1.9741 0.3811 0.5213 0.4112 0.5035 0.4900 0.6961 0.3271 0.3215 36.4254 12.4578 4.0144 11.5705 8.6096 5.1735 17.1477 14.7701 9.9767 1.8333 0.3876 0.5553 0.4886 0.5043 0.5494 0.7419 0.3113 0.3270 36.4292 12.4064 3.9842 11.6033 8.6761 5.0804 17.1591 13.2460 10.1677 1.7000 0.3982 0.5879 0.5610 0.5326 0.6301 0.7922 0.3065 0.3471 36.4316 12.3591 3.9476 11.6257 8.7410 4.9973 17.1724 11.8577 10.3716 1.5739 0.4123 0.6167 0.6194 0.5927 0.7186 0.8277 0.3239 0.3860 36.4336 12.3147 3.9051 11.6383 8.7964 4.9282 17.1792 10.6488 10.5799 1.4567 0.4234 0.6419 0.6563 0.6747 0.8007 0.8386 0.3649 0.4371 36.4353 12.2702 3.8579 11.6452 8.8352 4.8767 17.1745 9.6338 10.7817 1.3565 0.4229 0.6645 0.6668 0.7620 0.8641 0.8301 0.4186 0.4864 36.4360 12.2222 3.8073 11.6517 8.8508 4.8447 17.1545 8.8029 10.9637 1.2873 0.4058 0.6838 0.6521 0.8416 0.8987 0.8191 0.4660 0.5147 36.4355 12.1685 3.7552 11.6623 8.8363 4.8323 17.1166 8.1318 11.1106 1.2622 0.3745 0.6984 0.6214 0.9065 0.9022 0.8226 0.4880 0.5085 36.4346 12.1085 3.7035 11.6786 8.7855 4.8362 17.0606 7.5916 11.2090 1.2822 0.3400 0.7067 0.5863 0.9521 0.8820 0.8492 0.4797 0.4722 36.4354 12.0435 3.6536 11.6990 8.6939 4.8501 16.9899 7.1541 11.2495 1.3326 0.3179 0.7091 0.5555 0.9718 0.8473 0.8968 0.4580 0.4283 36.4404 11.9749 3.6067 11.7198 8.5594 4.8659 16.9117 6.7933 11.2286 1.3927 0.3185 0.7086 0.5329 0.9578 0.8024 0.9538 0.4475 0.3992 36.4523 11.9030 3.5638 11.7376 8.3833 4.8760 16.8351 6.4855 11.1482 1.4553 0.3366 0.7109 0.5208 0.9067 0.7528 1.0067 0.4547 0.3826 36.4727 11.8281 3.5262 11.7507 8.1695 4.8757 16.7688 6.2099 11.0152 1.5317 0.3562 0.7210 0.5201 0.8267 0.7157 1.0546 0.4648 0.3702 36.5020 11.7513 3.4944 11.7596 7.9234 4.8640 16.7207 5.9501 10.8386 1.6355 0.3620 0.7388 0.5285 0.7389 0.7220 1.1091 0.4635 0.3902 36.5398 11.6738 3.4683 11.7657 7.6512 4.8426 16.6989 5.6961 10.6268 1.7604 0.3452 0.7583 0.5414 0.6652 0.7953 1.1759 0.4492 0.4710 36.5843 11.5957 3.4464 11.7701 7.3578 4.8138 16.7112 5.4440 10.3846 1.8798 0.3080 0.7684 0.5553 0.6175 0.9190 1.2436 0.4338 0.5751 36.6333 11.5169 3.4266 11.7736 7.0468 4.7787 16.7635 5.1950 10.1127 1.9615 0.2694 0.7576 0.5674 0.6074 1.0395 1.2922 0.4347 0.6431 36.6835 11.4387 3.4066 11.7773 6.7196 4.7368 16.8568 4.9526 9.8111 1.9826 0.2562 0.7203 0.5744 0.6543 1.1078 1.3029 0.4589 0.6457 36.7313 11.3639 3.3845 11.7827 6.3767 4.6867 16.9864 4.7210 9.4818 1.9353 0.2697 0.6623 0.5719 0.7571 1.1097 1.2586 0.4957 0.5940 36.7742 11.2960 3.3598 11.7932 6.0201 4.6283 17.1433 4.5055 9.1330 1.8258 0.2903 0.6014 0.5548 0.8827 1.0668 1.1537 0.5284 0.5280 36.8113 11.2372 3.3335 11.8132 5.6546 4.5636 17.3164 4.3124 8.7814 1.6732 0.3100 0.5600 0.5201 0.9973 1.0228 1.0076 0.5450 0.4908 36.8441 11.1875 3.3074 11.8441 5.2885 4.4970 17.4961 4.1480 8.4519 1.5096 0.3306 0.5511 0.4700 1.0877 1.0200 0.8627 0.5407 0.5092 36.8756 11.1457 3.2836 11.8809 4.9318 4.4343 17.6763 4.0177 8.1722 1.3746 0.3497 0.5713 0.4150 1.1565 1.0521 0.7622 0.5244 0.5773 36.9089 11.1112 3.2636 11.9135 4.5944 4.3814 17.8524 3.9233 7.9660 1.2970 0.3608 0.6091 0.3728 1.2066 1.0691 0.7235 0.5244 0.6531 36.9466 11.0843 3.2483 11.9314 4.2853 4.3422 18.0197 3.8612 7.8480 1.2750 0.3616 0.6530 0.3593 1.2313 1.0434 0.7265 0.5583 0.6997 36.9899 11.0654 3.2385 11.9287 4.0119 4.3175 18.1746 3.8247 7.8235 1.2797 0.3565 0.6926 0.3724 1.2153 0.9955 0.7351 0.5931 0.7081 37.0381 11.0535 3.2340 11.9058 3.7799 4.3056 18.3171 3.8064 7.8911 1.2832 0.3532 0.7222 0.3948 1.1445 0.9601 0.7306 0.5792 0.6784 37.0891 11.0456 3.2338 11.8688 3.5939 4.3035 18.4491 3.8008 8.0480 1.2755 0.3571 0.7434 0.4125 1.0174 0.9362 0.7181 0.4988 0.6077 37.1407 11.0384 3.2360 11.8276 3.4579 4.3082 18.5695 3.8054 8.2911 1.2612 0.3703 0.7602 0.4191 0.8520 0.8889 0.7052 0.3816 0.5035 37.1918 11.0303 3.2386 11.7923 3.3754 4.3176 18.6709 3.8195 8.6149 1.2478 0.3941 0.7740 0.4133 0.6908 0.8009 0.6873 0.3005 0.3924 37.2431 11.0226 3.2406 11.7699 3.3484 4.3299 18.7435 3.8415 9.0109 1.2363 0.4259 0.7848 0.3993 0.6008 0.7054 0.6577 0.3110 0.3172 37.2966 11.0182 3.2416 11.7630 3.3757 4.3438 18.7805 3.8669 9.4690 1.2218 0.4546 0.7949 0.3844 0.6220 0.6696 0.6186 0.3604 0.3181 37.3542 11.0209 3.2420 11.7701 3.4519 4.3584 18.7820 3.8892 9.9792 1.2009 0.4670 0.8076 0.3746 0.7102 0.7191 0.5761 0.3893 0.3856 37.4162 11.0334 3.2420 11.7876 3.5673 4.3728 18.7546 3.9028 10.5310 1.1786 0.4593 0.8233 0.3726 0.8082 0.8015 0.5335 0.3967 0.4809 37.4804 11.0568 3.2420 11.8116 3.7109 4.3862 18.7079 3.9041 11.1132 1.1636 0.4402 0.8392 0.3758 0.9032 0.8653 0.4911 0.4229 0.5771 37.5435 11.0904 3.2425 11.8388 3.8722 4.3976 18.6513 3.8928 11.7147 1.1574 0.4223 0.8515 0.3787 1.0039 0.9028 0.4497 0.5021 0.6492 37.6020 11.1333 3.2435 11.8672 4.0436 4.4064 18.5916 3.8725 12.3254 1.1497 0.4128 0.8574 0.3780 1.1028 0.9298 0.4169 0.6177 0.6738 37.6547 11.1841 3.2443 11.8953 4.2201 4.4126 18.5336 3.8498 12.9363 1.1272 0.4130 0.8555 0.3745 1.1713 0.9580 0.4067 0.7217 0.6514 37.7023 11.2415 3.2436 11.9208 4.3996 4.4166 18.4819 3.8318 13.5405 1.0820 0.4236 0.8481 0.3704 1.1811 0.9809 0.4293 0.7698 0.6230 37.7465 11.3032 3.2407 11.9410 4.5819 4.4191 18.4406 3.8231 14.1326 1.0183 0.4456 0.8400 0.3670 1.1228 0.9772 0.4739 0.7405 0.6383 37.7884 11.3664 3.2351 11.9526 4.7686 4.4208 18.4091 3.8247 14.7085 0.9545 0.4768 0.8355 0.3624 1.0109 0.9267 0.5121 0.6445 0.6864 37.8287 11.4285 3.2273 11.9520 4.9624 4.4224 18.3794 3.8363 15.2657 0.9136 0.5085 0.8330 0.3532 0.8771 0.8305 0.5241 0.5224 0.7121 37.8679 11.4876 3.2183 11.9367 5.1659 4.4243 18.3363 3.8603 15.8031 0.9126 0.5276 0.8254 0.3390 0.7547 0.7249 0.5193 0.4301 0.6920 37.9073 11.5425 3.2093 11.9061 5.3800 4.4259 18.2617 3.9058 16.3215 0.9637 0.5221 0.8043 0.3245 0.6700 0.6759 0.5265 0.4026 0.6516 37.9490 11.5920 3.2016 11.8624 5.6032 4.4252 18.1427 3.9921 16.8234 1.0660 0.4874 0.7666 0.3172 0.6424 0.7230 0.5644 0.4176 0.6345 37.9959 11.6336 3.1968 11.8106 5.8308 4.4191 17.9766 4.1517 17.3095 1.1937 0.4306 0.7168 0.3235 0.6805 0.8332 0.6299 0.4394 0.6616 38.0509 11.6646 3.1957 11.7561 6.0555 4.4042 17.7699 4.4389 17.7753 1.3122 0.3707 0.6660 0.3447 0.7740 0.9443 0.7069 0.4616 0.7120 38.1152 11.6833 3.1989 11.7023 6.2703 4.3788 17.5339 4.9468 18.2093 1.4050 0.3296 0.6245 0.3768 0.8960 1.0094 0.7769 0.4924 0.7467 38.1881 11.6909 3.2062 11.6494 6.4692 4.3442 17.2791 5.8236 18.5934 1.4806 0.3165 0.5922 0.4129 1.0133 1.0090 0.8257 0.5476 0.7388 38.2675 11.6905 3.2181 11.5957 6.6477 4.3047 17.0142 7.2585 18.9062 1.5615 0.3219 0.5609 0.4490 1.0956 0.9501 0.8463 0.6328 0.6873 38.3507 11.6854 3.2360 11.5410 6.8022 4.2679 16.7468 9.4128 19.1254 1.6649 0.3316 0.5259 0.4864 1.1222 0.8524 0.8440 0.7123 0.6137 38.4350 11.6792 3.2615 11.4867 6.9295 4.2417 16.4839 12.3288 19.2313 1.7896 0.3365 0.4950 0.5287 1.0878 0.7360 0.8358 0.7352 0.5367 38.5179 11.6759 3.2956 11.4343 7.0276 4.2311 16.2319 15.8693 19.2110 1.9199 0.3328 0.4831 0.5758 1.0013 0.6257 0.8381 0.6843 0.4668 38.5970 11.6794 3.3369 11.3852 7.0953 4.2375 15.9969 19.7296 19.0642 2.0359 0.3227 0.4949 0.6185 0.8803 0.5495 0.8666 0.5815 0.4520 38.6714 11.6937 3.3823 11.3405 7.1327 4.2591 15.7849 23.5219 18.8059 2.1176 0.3123 0.5191 0.6443 0.7441 0.5231 0.9426 0.4676 0.5372 38.7409 11.7216 3.4272 11.3025 7.1414 4.2929 15.6002 26.8962 18.4629 2.1484 0.3071 0.5423 0.6477 0.6118 0.5382 1.0659 0.3890 0.6687 38.8069 11.7643 3.4679 11.2751 7.1259 4.3362 15.4448 29.6348 18.0655 2.1195 0.3092 0.5582 0.6323 0.5063 0.5746 1.1965 0.3855 0.7743 38.8711 11.8219 3.5015 11.2639 7.0945 4.3874 15.3211 31.6823 17.6394 2.0340 0.3189 0.5668 0.6045 0.4567 0.6143 1.2825 0.4512 0.8227 38.9354 11.8935 3.5270 11.2743 7.0594 4.4460 15.2348 33.1263 17.2017 1.9070 0.3324 0.5685 0.5649 0.4727 0.6395 1.2899 0.5311 0.8124 39.0013 11.9780 3.5452 11.3088 7.0344 4.5124 15.1955 34.1593 16.7591 1.7605 0.3444 0.5641 0.5082 0.5263 0.6325 1.2114 0.5752 0.7543 39.0703 12.0754 3.5583 11.3649 7.0314 4.5873 15.2126 35.0282 16.3088 1.6139 0.3519 0.5575 0.4334 0.5878 0.5936 1.0632 0.5685 0.6626 39.1430 12.1873 3.5692 11.4341 7.0564 4.6712 15.2904 35.9638 15.8407 1.4779 0.3543 0.5543 0.3530 0.6466 0.5527 0.8755 0.5298 0.5555 39.2188 12.3176 3.5811 11.5041 7.1082 4.7643 15.4269 37.1109 15.3431 1.3623 0.3544 0.5601 0.2909 0.6972 0.5395 0.6935 0.4878 0.4559 39.2959 12.4723 3.5961 11.5628 7.1807 4.8662 15.6132 38.5116 14.8071 1.2850 0.3550 0.5819 0.2628 0.7287 0.5337 0.5879 0.4534 0.3849 39.3724 12.6593 3.6159 11.6007 7.2661 4.9766 15.8346 40.1468 14.2288 1.2700 0.3537 0.6216 0.2676 0.7331 0.4983 0.5926 0.4205 0.3590 39.4476 12.8863 3.6414 11.6121 7.3591 5.0947 16.0755 41.9703 13.6102 1.3313 0.3470 0.6720 0.3025 0.7114 0.4442 0.6287 0.3824 0.3736 39.5231 13.1580 3.6733 11.5965 7.4573 5.2199 16.3278 43.9078 12.9599 1.4625 0.3349 0.7267 0.3626 0.6712 0.4215 0.6253 0.3377 0.3899 39.6013 13.4727 3.7120 11.5590 7.5608 5.3498 16.5985 45.8437 12.2938 1.6386 0.3202 0.7912 0.4291 0.6262 0.4536 0.5934 0.2897 0.3758 39.6851 13.8209 3.7581 11.5076 7.6701 5.4807 16.9106 47.6236 11.6357 1.8269 0.3073 0.8769 0.4767 0.5881 0.5130 0.5766 0.2458 0.3393 39.7771 14.1864 3.8119 11.4511 7.7849 5.6075 17.2936 49.0996 11.0160 1.9941 0.2998 0.9862 0.4922 0.5557 0.5654 0.5944 0.2163 0.3237 39.8780 14.5483 3.8726 11.3970 7.9037 5.7260 17.7725 50.1961 10.4666 2.1123 0.2985 1.1048 0.4823 0.5217 0.5916 0.6407 0.2090 0.3501 39.9870 14.8840 3.9380 11.3500 8.0238 5.8338 18.3610 50.9308 10.0129 2.1639 0.3021 1.2089 0.4645 0.4872 0.5864 0.7029 0.2222 0.3774 40.1020 15.1721 4.0042 11.3119 8.1419 5.9308 19.0603 51.3798 9.6684 2.1482 0.3084 1.2759 0.4541 0.4593 0.5534 0.7612 0.2474 0.3663 40.2214 15.3958 4.0662 11.2827 8.2549 6.0186 19.8593 51.6363 9.4330 2.0842 0.3147 1.2924 0.4572 0.4440 0.5004 0.7949 0.2736 0.3205 40.3434 15.5453 4.1204 11.2621 8.3605 6.0992 20.7400 51.7884 9.2960 2.0038 0.3178 1.2565 0.4692 0.4493 0.4417 0.8057 0.2922 0.2812 40.4654 15.6191 4.1645 11.2492 8.4564 6.1743 21.6863 51.9105 9.2399 1.9376 0.3139 1.1772 0.4823 0.4816 0.4022 0.8216 0.3079 0.2884 40.5836 15.6234 4.1987 11.2417 8.5402 6.2445 22.6896 52.0567 9.2459 1.9022 0.2997 1.0710 0.4910 0.5299 0.3999 0.8629 0.3331 0.3334 40.6949 15.5710 4.2247 11.2357 8.6096 6.3095 23.7439 52.2497 9.2981 1.8997 0.2780 0.9550 0.4908 0.5671 0.4250 0.9097 0.3649 0.3866 40.7985 15.4777 4.2446 11.2279 8.6635 6.3670 24.8330 52.4668 9.3873 1.9247 0.2617 0.8433 0.4758 0.5710 0.4561 0.9283 0.3841 0.4301 40.8969 15.3601 4.2607 11.2169 8.7025 6.4133 25.9205 52.6304 9.5135 1.9722 0.2633 0.7447 0.4416 0.5371 0.4808 0.9133 0.3808 0.4575 40.9965 15.2336 4.2752 11.2034 8.7293 6.4447 26.9518 52.6051 9.6836 2.0413 0.2806 0.6631 0.3954 0.4801 0.4922 0.8940 0.3646 0.4670 41.1068 15.1104 4.2898 11.1887 8.7482 6.4590 27.8668 52.2110 9.9065 2.1331 0.3086 0.5962 0.3578 0.4236 0.4870 0.9082 0.3427 0.4580 41.2404 14.9990 4.3058 11.1742 8.7637 6.4565 28.6187 51.2717 10.1855 2.2487 0.3531 0.5391 0.3496 0.3881 0.4736 0.9762 0.3071 0.4349 41.4098 14.9057 4.3241 11.1615 8.7789 6.4395 29.1927 49.7087 10.5159 2.3891 0.4214 0.4895 0.3751 0.3886 0.4797 1.0976 0.2619 0.4119 41.6201 14.8352 4.3454 11.1526 8.7960 6.4126 29.6180 47.6594 10.8884 2.5576 0.5101 0.4511 0.4264 0.4320 0.5356 1.2598 0.2478 0.4117 41.8593 14.7905 4.3703 11.1483 8.8163 6.3819 29.9633 45.5317 11.2925
This is because for std() the optional dimension argument is third, whereas for mean() it is second. Documentation: mean std

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by