Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 我如何在uitable中赋值?_Matlab_Matlab Uitable - Fatal编程技术网

Matlab 我如何在uitable中赋值?

Matlab 我如何在uitable中赋值?,matlab,matlab-uitable,Matlab,Matlab Uitable,我试图弄清楚如何在uitable中赋值。我从我的数据矩阵中自动得到了表的大小,我可以根据需要在前两列中定义值,但我不知道如何填充第三列。可以手工填写这一栏吗?在尝试填充第三列的过程中,我得到一个警告:表数据在此位置不可编辑 谢谢你的帮助 a = text2(:,(1:c11)); b = in_matrix(1,(1:c11)); cnames = {'Name','Name','Value'}; rnames = 1:c11; Data = transpose(a); f = figure('

我试图弄清楚如何在uitable中赋值。我从我的数据矩阵中自动得到了表的大小,我可以根据需要在前两列中定义值,但我不知道如何填充第三列。可以手工填写这一栏吗?在尝试填充第三列的过程中,我得到一个警告:表数据在此位置不可编辑

谢谢你的帮助

a = text2(:,(1:c11));
b = in_matrix(1,(1:c11));
cnames = {'Name','Name','Value'};
rnames = 1:c11;
Data = transpose(a);
f = figure('Position', [100 100 500 500]);
t = uitable('Parent', f, 'Position', [50 100 300 400],...
        'Data',Data,...
        'ColumnName',cnames,...
        'RowName',rnames,...
        'Enable','on',...
        'Visible','on');   
set(t,'ColumnFormat',{'char','char','numeric'});
set(t,'ColumnEditable',[false,false,true]);   

首先,不要将
文本
用作变量名,因为它是一个内置函数,可能会导致问题。第二,我认为到目前为止你们已经做到了:

content = {'neuer Schaufeltyp'         '[]'    [     0.8]; ...
'Geometrienummer'           '[]'    [ 0.16667]; ...
'neuer Bearbeitungstyp'     '[]'    [ 0.29231]; ...
'D'                         '[]'    [0.066667]; ...
'L1'                        '[]'    [ 0.73529]; ...
'Schneiden'                 '[]'    [     0.1]; ...
'fz'                        '[]'    [     0.1]; ...
'Einstellwinkel'            '[]'    [       0]; ...
'Schneidenradius'           '[]'    [       0]; ...
'Kühlung'                   '[]'    [ 0.33333]; ...
'GleichGegen'               '[]'    [       1]; ...
'Verh. D-WZ/Eingriffsbr'    '[]'    [       0]; ...
'neuer Werkstoff'           '[]'    [ 0.11111]}.';

c11 = 13;
a = content(:,(1:c11));
cnames = {'Name','Name','Value'};
rnames = 1:c11;
Data = a.';
f = figure('Position', [100 100 500 500]);
t = uitable('Parent', f, 'Position', [50 100 300 400],...
        'Data',Data,...
        'ColumnName',cnames,...
        'RowName',rnames,...
        'Enable','on',...
        'Visible','on');
现在我有点困惑了,你想填第二栏还是第三栏?你想用编码还是手工

要手动填充第三列,您需要使用属性
columneditable
使其可编辑,并定义
ColumnFormat

set(t,'ColumnFormat',{'char','char','numeric'})
set(t,'ColumnEditable',[false,false,true])
或者在开始时与所有其他属性一起执行

然后你得到你的表格,在那里你可以手动插入第三列中的值(我插入了42 always):


首先感谢您的建议。你是对的,这绝对是我想做的。再次感谢您的关注谢谢:D@meryem不客气。如果这是您正在寻找的答案,请单击左侧的绿色复选标记表示问题已解决,以接受该答案。谢谢:)@peter,但是是的,我遇到了一个错误:警告:表数据在此位置不可编辑。所以我想手工填写,我会看看这是怎么可能的,但如果你让我知道更多我能做的事情会很好让我知道,再次感谢:)我的答案中的代码对你有用吗?请编辑您的问题,这样我就可以复制并粘贴它,看看您的问题是什么。完成了,再次感谢@thewaywewalk:)