Datepicker picker usage in uitable

11 ビュー (過去 30 日間)
EDMOND
EDMOND 2023 年 5 月 19 日
回答済み: Narvik 2024 年 9 月 3 日
I'm uploading data into uitable I want user to use datepicker to set date and upload to uitable at date column
  1 件のコメント
dpb
dpb 2023 年 5 月 19 日
So, what's the Q?

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

回答 (1 件)

Narvik
Narvik 2024 年 9 月 3 日
Hi Edmond,
As per my understanding, you are trying to create an application where the user can select a date using a date picker and update a specific column in a "uitable" in MATLAB.
Assuming you are using App Designer, start by adding a "uitable" component for data display and include a "uidatepicker" component for date selection in your application.
Refer to the following documentation links for more information on "uitable" and "uidatepicker" respectively:
After adding the above components to your application, implement a callback for the date picker to capture the selected date and update the "Date" column in the table with this value.
Refer to the following sample callback function for data picker:
% assuming you have a uitable named 'Table' and a uidatepicker named 'DatePicker',
% callback function for the DatePicker
function datePickerValueChanged(app, event)
% get the selected date from the date picker
selectedDate = app.DatePicker.Value;
% convert the date to a string format if necessary
dateStr = datestr(selectedDate, 'mm/dd/yyyy');
% get the current data from the uitable
tableData = app.Table.Data;
% define your row selection logic
currentRow = app.SelectedRow;
% update the 'Date' column of the selected row
% assuming the 'Date' column is the second column
tableData{currentRow, 2} = dateStr;
% update the table with the new data
app.Table.Data = tableData;
end
Hope this helps!

カテゴリ

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

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by