- Lazy Loading for UI Components : Implement pagination in your UI to load and display data in small subsets, updating the view as users scroll or navigate through the table.
- Use virtual scrolling to render only the visible rows plus a buffer, dynamically loading and unloading data as the user scrolls.
Improving table loading time on App Designer for large dataset
조회 수: 10 (최근 30일)
이전 댓글 표시
I'm using a matlab script to evaluate data, format it in a table and store the result in a .mat file. Currently the table contains 2400x2034 data points but the final table would be 12000x2034 or larger.
The structure of the table is:
categorical(string), categorical(string), categorical(string), categorical(string), 1015xdouble, 1015xdouble
To display the data, I would like to build a simple app that would read the .mat file and display the whole or sections of table. However, the App Designer struggles even with small amounts of data. Displaying 8x2034 rows takes several seconds to load. With more entries, scrolling through the table causes stutters.
I have tried different version of .mat file with/without compression but unfortunately did not help.
The code to load the table at the startup-callback for the app:
% Code that executes after component creation
function startupFcn(app)
%If a completed Table already exists load it, otherwise create empty table
if isfile('completeTable.mat')
load('completeTable.mat');
end
app.completeTable = completeTable;
app.AvailableSpeciesListBox.Items = unique(app.completeTable.Shorthand);
end
And the code for loading the data into the table, upon selecting an entry in an itemlist:
% Value changed function: AvailableSpeciesListBox
function AvailableSpeciesListBoxValueChanged(app, event)
value = app.AvailableSpeciesListBox.Value;
selectedEntries = app.completeTable(app.completeTable.Shorthand == value,:);
app.UITable.Data = selectedEntries(:,2:width(app.completeTable));
end
댓글 수: 0
답변 (1개)
Vidhi Agarwal
2024년 5월 8일
Hi Mario,
I understand you are facing an issue with the efficiency in loading the .mat file. Here’s an approach that can help you in getting started:
Here’s a sample code that can help in understanding the implementation of Lazy loading.
function updateTableDisplay(app, startIndex, endIndex)
% Load and display a subset of the data from startIndex to endIndex
if isfile('completeTable.mat')
% Assuming completeTable.mat has a variable 'completeTable' in it
m = matfile('completeTable.mat');
subsetOfData = m.completeTable(startIndex:endIndex, :);
app.UITable.Data = subsetOfData(:,2:width(subsetOfData));
end
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!