How to read data in app.UITable?

조회 수: 22 (최근 30일)
Philip Chen
Philip Chen 2021년 11월 4일
편집: Dave B 2021년 11월 4일
I want to read csv data to the app.UITable that I created in my GUI app. But when I pressed the button that reads the CSV file, the data is read in a table generated from a new window, rather than the UITable in the GUI window.
How can I fix this?
function BrowseforExcelfileButtonPushed(app, event)
t = readtable('Calibration243A.csv');
vars = {'Tone','Unit','Value'};
t = t(1:11,vars);
%Create a table UI component, and specify t as the data.
fig = uifigure;
uit = uitable(fig,'Data',t);
end

답변 (1개)

Dave B
Dave B 2021년 11월 4일
편집: Dave B 2021년 11월 4일
Instead of creating a new figure (with the uifigure function) and a new uitable (with the uitable function), just set the Data property on your existing app.UITable (I'm assuming you already have a property in your app called UITable, but if that's not what it's called use whatever name)
app.UITable.Data = t;

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by