synonyms functions for uigetfile or uiopen

1 Ansicht (letzte 30 Tage)
SETH GERSBACH
SETH GERSBACH am 22 Mai 2022
Beantwortet: Walter Roberson am 22 Mai 2022
synonyms functions for uigetfile or uiopen
trying to open a text file, but do it in a way i can select muiltple different files

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 22 Mai 2022
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.

Weitere Antworten (0)

Kategorien

Mehr zu Develop uifigure-Based Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by