Importing Data into GUI Table

5 ビュー (過去 30 日間)
Jonathan Moorman
Jonathan Moorman 2021 年 12 月 21 日
コメント済み: Voss 2021 年 12 月 21 日
All,
I'm sure this is probably an easy answer, but how do you write data to a GUI handle (app.UITable)? The method below creates a new, windowed table and writes to it, but I only want to put my data into the already existing one shown below for my user interface.
[file,path] = uigetfile({'*.xlsx'},'Select an Excel File');
figure(app.UIFigure)
PathAndFile = [path,file];
t = readtable(PathAndFile);
fig = uifigure;
uit = uitable(fig,'Data',t);
uit.Data = t;
  3 件のコメント
Jonathan Moorman
Jonathan Moorman 2021 年 12 月 21 日
It doesn't seem to recognize it. Nothing happens when I try
Voss
Voss 2021 年 12 月 21 日
I'm assuming uit and t are your uitable and data. If they are refered to as something else, you'd have to change the syntax, e.g., as in @Image Analyst's answer.

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

回答 (1 件)

Image Analyst
Image Analyst 2021 年 12 月 21 日
If @Benjamin's suggestion, which I think should be
app.uit.Data = t;
instead of
uit.Data = t;
didn't work, maybe try turning it from a table into an array
app.uit.Data = table2array(t);

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by