Compute the mean of each vector in cell array C. C = {1:10, [2; 4; 6], []}; averages = cellfun(@mean, C) This code returns averages = 5.5000 4.0000 NaN ............................................................. 该函数就是专门对cell数组进行操作的,个人认为是代替了传统的for循环
randi()函数生成均匀分布的伪随机整数,范围为imin--imax,如果没指定imin,则默认为1. r = randi(imax,n):生成n*n的矩阵 r = randi(imax,m,n):生成m*n的矩阵 r = randi(imax,[m,n]):同上 r = randi(imax,m,n,p,...):生成m*n*p*...的矩阵 r = randi(imax,[m,n,p,...])同上 r = randi(imax):1*1的矩阵 r = randi(imax,size(A)