计算uitable中的行数

时间:2014-07-10 11:16:02

标签: matlab matlab-uitable

我无法计算我的uitable中的行数。

data={'for' '32' '1'
      '123' 'tired' '3g'
      '0' 'door' 'roof'};
w=uitable('data',data,'position',[100 100 100 100])

我已经尝试过命令高度,但是我收到错误说

Undefined function 'height' for input arguments of type 'double'.

Error in boundary_conditions (line 9)
height(w)

1 个答案:

答案 0 :(得分:1)

第一部分初始化uitable并显示它:

data={'for' '32' '1'                               
'123' 'tired' '3g'                                 
'0' 'door' 'roof'};                                
w=uitable('data',data,'position',[100 100 100 100])

现在为了get / set对象属性,可以遵循此howto。以下是满足您需求的示例:

prop = {'data','position'};                                                       
attributes = get(w,prop);
>> attributes

attributes = 

    {3x3 cell}    [1x4 double]

>> attributes{1}

ans = 

    'for'    '32'       '1'   
    '123'    'tired'    '3g'  
    '0'      'door'     'roof'

>> size(attributes{1},1)

ans =

     3