synonyms functions for uigetfile or uiopen

3 次查看(过去 30 天)
synonyms functions for uigetfile or uiopen
trying to open a text file, but do it in a way i can select muiltple different files

采纳的回答

Walter Roberson
Walter Roberson 2022-5-22
You can use uigetfile() with 'multiselect', 'on' .
The first output of uigetfile() will be numeric if the user cancelled.
The first output of uigetfile() will be a character vector if the user selected exactly one file.
The first output of uigetfile() will be a cell array of character vector if the user selected more than one file.
I suggest using something like,
[selfiles, selpath] = uigetfile('*.txt', 'multiselect', 'on');
if isnumeric(selfiles); return; end %user cancel
filenames = fullfile(selpath, cellstr(selfiles));
After that, filenames will be a cell array of character vectors of fully-qualified file names; you will not need to test for the special case that the user selected exactly one file.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by