フィルターのクリア

How do i add a pushbutton to an already created uitable in GUI matlab?

6 ビュー (過去 30 日間)
sachin narain
sachin narain 2018 年 4 月 18 日
コメント済み: sachin narain 2018 年 4 月 20 日
I want to add a new pushbutton in an already created uitable by hardcoding it. For now i have created a UI table like this by adding a pushbutton to create it:
function table_Button_Callback(hObject, eventdata, handles)
handles.Load_data=uitable('Parent',figure,'Units','normalized',...
'Position',[0.008 0.5 5 0.5],'ColumnWidth','auto', ...
'Data', tabledata,'ColumnName', columnname, ...
'ColumnFormat', columnformat,'ColumnEditable', columneditable, ...
'RowName',[] ,'BackgroundColor',[.7 .9 .8],'ForegroundColor',[0 0 0]);
Now i want to add another button inside this table to create more number of rows.How do i create that button inside the table. Thank you in advance.I am new to matlab GUide.Kindly help with this.
  2 件のコメント
Geoff Hayes
Geoff Hayes 2018 年 4 月 18 日
sachin - please clarify what you mean by i want to add another button inside this table. Do you just want another button on your GUI that, when pushed, will add more rows to this table?
sachin narain
sachin narain 2018 年 4 月 18 日
Yes u understood right
I want to do two things: 1.First to create a pushbutton inside the UItable figure i have already created 2.This pushbutton will add extra rows to the data

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

採用された回答

Geoff Hayes
Geoff Hayes 2018 年 4 月 19 日

sachin - once you add your new button (to your GUI) you can use the following callback to add one new row to the table

 function addRowsButton_Callback(hObject, eventdata, handles)
 tableData = get(handles.Load_data, 'Data');
 % add one new row
 if iscell(tableData)
     tableData(end+1,:)={[]};
 else
     tableData(end+1,:)=[];
 end
 set(handles.Load_data, 'Data', tableData);

Try the above and see what happens!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by