You could replace the zeros with NaN, then use the 'omitnan' option in the mean, median, max and min functions.
mean(xX1,"omitnan")
ans =
111.1175 111.9158 116.1595 109.2205 112.3463 98.9689 114.1767 114.2327 111.7080 113.3142 128.4990 98.9565 142.8296 117.6648 143.4093 116.2192 113.9829 137.8247 134.2644 112.6484 146.7604 113.0359 149.6482 108.1699 139.1788 139.1788 136.4579 111.9057 138.1576 138.1576
median(xX1,"omitnan")
ans =
99.5444 99.6217 99.9971 98.5570 98.5408 91.7533 98.7447 99.0285 99.2992 99.4590 104.7525 91.7536 106.2120 99.1072 107.6894 101.3442 99.0944 106.5169 104.0568 98.6323 107.6290 98.0593 109.1235 98.2417 102.6912 102.6912 107.1210 98.9206 100.8909 100.8909
max(xX1,[],"omitnan")
ans =
157.8314 164.6824 181.0046 152.7691 171.4886 157.3913 179.2350 178.5693 162.1231 173.8150 248.3298 157.3913 305.5951 179.6339 294.4348 183.3821 180.2525 302.6373 270.3745 177.8871 305.4929 174.4470 355.9559 143.7747 341.6236 341.6236 288.5927 170.6274 355.0885 355.0885
min(xX1,[],"omitnan")
ans =
87.8088 87.7950 86.3213 87.6592 87.7570 88.9939 86.9030 86.8868 87.4553 87.6818 82.7320 88.9939 74.6615 86.3000 81.1566 87.8140 87.6421 77.0906 84.6946 86.8836 75.6674 86.5045 79.5652 88.0240 67.5941 67.5941 78.0374 87.9315 66.8053 66.8053
By the way, you want to avoid naming your variables the same as MATLAB functions. That replaces the function with the variable, which will prevent you from using the function.
mean2 = mean(X2;)
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.