필터 지우기
필터 지우기

Load output files and display file names on the uitable for file selection at app designer

조회 수: 8 (최근 30일)
I want to load output files to select some files to compare.
  1. First, read files like below (It was OK)
function [A D] = file_read(app);
[file_p, pathname] = uigetfile( ...
{'*.mat','MAT-files (*.mat)'},...
'Pick a file');%
load(file_p);
app.EditField.Value = file_p;
end
2. Next, I want to display selected file names on the uitable(UIFigure) to choice files for compare
I tryed like below but not found solutions yet.
function AddButtonPushed(app, event)
d_num = [];
app.d{d_num+1} = {true, app.EditField.Value} ;
uit = uitable(app.UIFigure,'ColumnWidth',{50,'auto'},'ColumnEditable',[true false]);
uit.ColumnName = {'Select','File name'};
uit.Data = app.d{:,:};
uit.ColumnSortable = true;
uit.Position = [20 20 600 250];
d_num = length(uit.Data);
end
Can I have solution ?

답변 (1개)

Ravi
Ravi 2023년 10월 5일
Hi JH Bang,
According to my understanding, you want to select files using uitable and later want to display them in a table.
The “file_read” function will work fine here. However, for the “AddButtonPushed” method, there is a workaround for concatenating new entries to the table data. I suggest you use the following concatenation method in your “AddButtonPushed” method
newEntry = {true, app.EditField.Value};
uit.Data = [uit.Data; newEntry];
Example:
x = [1 2 3];
y = [4 5 6];
x = [x; y];
disp(x);
1 2 3 4 5 6
Hope this helps.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by