Load output files and display file names on the uitable for file selection at app designer
3 次查看(过去 30 天)
显示 更早的评论
I want to load output files to select some files to compare.
- 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 ?
0 个评论
回答(1 个)
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);
Hope this helps.
0 个评论
另请参阅
类别
在 Help Center 和 File 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!