필터 지우기
필터 지우기

App developer: How to clean or reset a table

조회 수: 94 (최근 30일)
Benedikt Wessel
Benedikt Wessel 2018년 11월 9일
편집: Akshay Khadse 2018년 11월 19일
Hello everybody, how can I clear the content of a table? Is there a command like cla for graphs?
The table I'm talking about looks like this:
Thank you

답변 (1개)

Akshay Khadse
Akshay Khadse 2018년 11월 19일
편집: Akshay Khadse 2018년 11월 19일
I am assuming that you have a UITable in your app created via MATLAB App Designer.
There is no direct command to clear the contents of a UITable. However, you can use the following methods to achive this:
Method 1: If you specified the contents of the UITable as a cell array, you could manually find strings and numbers, and then replace them with empty strings '' or empty arrays [].
The following snippet should help you get started:
tableData = get(app.UITable,'Data');
charLocations = cellfun(@ischar, tableData);
tableData(charLocations) = {''};
tableData(~charLocations) = {[]};
set(app.UITable, 'Data', tableData);
The following more information on this please refer to the following MATLAB Answer:
Method 2: This applicable for any UITable irrespective of how the data is specified. You can replace the contents of the UITable with empty cell array or empty table as follows:
app.UItable.Data = {};

카테고리

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

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by