Creating a new table by selecting columns from an existing one using cell selection callback

4 ビュー (過去 30 日間)
hello, i want to create an application which reads the given table and allows user to select columns and then recreating a table with the selected columns. I am working on forecasting electricity prices and getting data from https://www.epias.com.tr/en/. my code is working on a fixed table template and that is date-hour-price. But some excel files have more than one currency and the table can be date-hour-turkish lira-usd-cad. i want user to be able to choose currency and work on it. reads table and user selects columns (date-hour-try/usd/cad) and creates new table consisted selected columns.Reading table and formatting is done but. selection callback and confirm push button callbacks are not working properly. it creates a table but table is irrelevant. it's like i can't keep the read data and create an empty one.
  • % app.CallingApp = mainapp;
[filename, ~] = uigetfile({'*.*';'*.xlsx'},'Search Data to be Read');
T=readtable(filename,"Sheet",1);
app.UITable.Data=T;
T.Properties.VariableNames{1} = 'Tarih';
T.Properties.VariableNames{2} = 'Saat';
T.Properties.VariableNames{3} = 'Tuketim';
app.UITable.ColumnName=T.Properties.VariableNames;
T.Saat=datetime(T.Saat,'Format','HH:mm');
T.Tarih=datetime(T.Tarih,'Format','dd.MM.yyyy');
T.Tarih.Format='dd.MM.uuuu HH:mm';
T.Saat.Format='dd.MM.uuuu HH:mm';
T.Tarih= T.Tarih + timeofday(T.Saat);
x=T.Tarih;
y=T.Tuketim;
app.T=table(x,y);
% Cell selection callback: UITable
function UITableCellSelection(app, event)
app.SelectedColumns = event.Indices;
function ConfirmButtonPushed(app, event)
app.SelectedColumns =app.T app.UITable.Data=app.T;

回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by