【问题标题】:Matlab Uitable Adding a logical column to existing tableMatlab Uitable向现有表添加逻辑列
【发布时间】:2012-07-04 07:54:32
【问题描述】:

我正在使用 UITABLE 来显示一些数据。显示表格后,我想在表格末尾添加一个逻辑列。并根据选中或未选中的列采取未来的行动。有什么想法吗?

【问题讨论】:

    标签: matlab user-interface checkbox matlab-uitable


    【解决方案1】:

    一个例子:

    %# initial table
    c1 = rand(10,3);
    h = uitable('Units','normalized', 'Position',[0 0 1 1], 'Data',c1);
    
    %# add new column of check boxes
    c2 = c1(:,1)>0.5;
    set(h, 'Data',[num2cell(c1) num2cell(c2)], ...
        'ColumnFormat',[repmat({[]},1,size(c1,2)),'logical'], ...
        'ColumnEditable',[false(1,size(c1,2)),true])
    

    您可能希望处理 CellEditCallback 以执行自定义操作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-28
      • 2017-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多