我正在使用 Scilab 在 2x2x2 立方体中平均 100x100x100 矩阵。如何更改此脚本以使其在 9x9x9 立方体中平均?我知道 100^3 不会均匀地划分为 9x9x9 立方体。我只想平均它直到它不能再均匀下潜。
a=1
    b=1
    c=1
    numbers = rand(100,100,100)
    while c <=99,
    if a>99 then
            a=1
            b=b+2
        c=1;
        end
    if b>99 then
        a=1
        b=1
        c=c+2;
        end
    average=(numbers(a,b,c)+numbers(a+1,b,c)+numbers(a,b+1,c)+numbers(a+1,b+1,c)                                    +numbers(a,b,c+1)+numbers(a+1,b,c+1)+numbers (a,b+1,c+1)+numbers(a+1,b+1,c+1))/8
    a=(a+2);
    end