Clear Filters
Clear Filters

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

8 views (last 30 days)
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 ?

Answers (1)

Ravi
Ravi on 5 Oct 2023
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.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!