synonyms functions for uigetfile or uiopen

조회 수: 1 (최근 30일)
SETH GERSBACH
SETH GERSBACH 2022년 5월 22일
답변: Walter Roberson 2022년 5월 22일
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