フィルターのクリア

how to insert value in uitable

37 ビュー (過去 30 日間)
best16 programmer
best16 programmer 2017 年 5 月 12 日
編集済み: dpb 2022 年 5 月 4 日
i have uitable with 5 columns and 2 rows,how can i insert a value in the fifth column and firt row.
is that possible ?
thank you.

採用された回答

Star Strider
Star Strider 2017 年 5 月 12 日
Try this:
f = figure;
t = uitable(f,'Data',randi(100,2,5));
t.Data(1,5) = 4242;
  2 件のコメント
best16 programmer
best16 programmer 2017 年 5 月 12 日
thank for the answer,what i mean is insert a value in the wanted column of the uitable
Star Strider
Star Strider 2017 年 5 月 12 日
My pleasure.
Your Question asked about the first row and fifth column.
You can easily adapt my Answer to insert a value in any row or column in your uitable. It uses standard MATLAB array addressing and indexing.
If you want to insert values in the fifth column, this works:
f = figure;
t = uitable(f,'Data',randi(100,2,5));
new_col = rand(2,1);
t.Data(:,5) = new_col;
I used two separate assignments to create the column and then do the substitution, for clarity.

サインインしてコメントする。

その他の回答 (2 件)

shiva sai
shiva sai 2017 年 5 月 13 日
編集済み: dpb 2022 年 5 月 4 日
t=handles.uitable1;
p=questdlg('options ','options menu','yes','no','no')
/* asking whether to enter data directly or to enter data in wanted row and column*/
switch p
case 'yes'
k=input('enter values as matrix');//enter data directly as matrix//
set(t,'Data',k);
case 'no' k=[ ; ; ];
set(t,'Data',k);
i=input('enter row'); %row no.
j=input('enter column'); //column no.
a=input('enter value to be inserted');//
value k(i,j)=a;
set(t,'Data',k);
end
option no will make data to enter as per wanted row and column if true % code end

shiva sai
shiva sai 2017 年 5 月 13 日
  2 件のコメント
shiva sai
shiva sai 2017 年 5 月 13 日
option no in question dialog box will make data to enter as per wanted row and column if true
best16 programmer
best16 programmer 2017 年 5 月 13 日
thank you for the answer.this is helpful

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by