24小时热门版块排行榜    

CyRhmU.jpeg
查看: 259  |  回复: 8
当前主题已经存档。

yujunhui

银虫 (著名写手)

[交流] 【求助】size 函数的用法?

size 函数是干什么用的?
其用法是什么?
回复此楼
安静
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

change0618

铁杆木虫 (著名写手)

方丈大师

★ ★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
kuhailangyu(金币+2,VIP+0):替楼主致谢了,呵呵 10-14 09:50
help size
SIZE   Size of array.  
    D = SIZE(X), for M-by-N matrix X, returns the two-element row vector
    D = [M,N] containing the number of rows and columns in the matrix.
    For N-D arrays, SIZE(X) returns a 1-by-N vector of dimension lengths.
    Trailing singleton dimensions are ignored.

    [M,N] = SIZE(X) for matrix X, returns the number of rows and columns in
    X as separate output variables.
   
    [M1,M2,M3,...,MN] = SIZE(X) for N>1 returns the sizes of the first N
    dimensions of the array X.  If the number of output arguments N does
    not equal NDIMS(X), then for:

    N > NDIMS(X), SIZE returns ones in the "extra" variables, i.e., outputs
                  NDIMS(X)+1 through N.
    N < NDIMS(X), MN contains the product of the sizes of dimensions N
                  through NDIMS(X).

    M = SIZE(X,DIM) returns the length of the dimension specified
    by the scalar DIM.  For example, SIZE(X,1) returns the number
    of rows. If DIM > NDIMS(X), M will be 1.

    When SIZE is applied to a Java array, the number of rows
    returned is the length of the Java array and the number of columns
    is always 1.  When SIZE is applied to a Java array of arrays, the
    result describes only the top level array in the array of arrays.

    Example:
    If
       X = rand(2,3,4);
    then
       d = size(X)              returns  d = [2 3 4]
       [m1,m2,m3,m4] = size(X)  returns  m1 = 2, m2 = 3, m3 = 4, m4 = 1
       [m,n] = size(X)          returns  m = 2, n = 12
       m2 = size(X,2)           returns  m2 = 3

    See also length, ndims, numel.
2楼2009-10-14 09:33:41
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

change0618

铁杆木虫 (著名写手)

方丈大师

发帖之前能不能help 一下啊?
3楼2009-10-14 09:34:22
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xichen4834

金虫 (小有名气)

我说楼上你都回复人家了,就别批评了!
4楼2009-10-14 16:37:04
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

change0618

铁杆木虫 (著名写手)

方丈大师


小木虫(金币+0.5):给个红包,谢谢回帖交流
但至少可以给他一个自己解决问题的一般途径
5楼2009-10-14 16:46:43
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yujunhui

银虫 (著名写手)


我也想help 但是 英文我看不懂!呵呵!
安静
6楼2009-10-14 16:47:02
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

change0618

铁杆木虫 (著名写手)

方丈大师

★ ★
小木虫(金币+0.5):给个红包,谢谢回帖交流
sunxiao(金币+1,VIP+0):再给你一个奖励 10-15 04:58

对二维矩阵a来讲:
[m,n]=size(a)  % m表示行数,n表示列数
m=size(a,1)   % 1表示求行数
n=size(a,2)   % 2表示求列数
以此类推
7楼2009-10-14 16:56:41
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

change0618

铁杆木虫 (著名写手)

方丈大师

>> a=[1 2 3 4;
2 3 4 5];
>> [m,n]=size(a)

m =

     2


n =

     4

>> m=size(a,1)

m =

     2

>> n=size(a,2)

n =

     4
8楼2009-10-14 16:58:39
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yujunhui

银虫 (著名写手)

引用回帖:
Originally posted by change0618 at 2009-10-14 16:56:

对二维矩阵a来讲:
[m,n]=size(a)  % m表示行数,n表示列数
m=size(a,1)   % 1表示求行数
n=size(a,2)   % 2表示求列数
以此类推

谢谢了!
安静
9楼2009-10-14 23:25:11
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 yujunhui 的主题更新
普通表情 高级回复(可上传附件)
信息提示
请填处理意见