Apply a function to several files using uigetfile

1 回表示 (過去 30 日間)
Isma_gp
Isma_gp 2018 年 5 月 24 日
コメント済み: Isma_gp 2018 年 5 月 24 日
Hi, I'm calling a function from a script. The function starts by using the uigetfile command to select the file that will be used throughout the function. I would like to apply the same function to several files, by selecting all the files at once. Right now I'm using the following code, but then I need to select one file at a time.
if true
folder = 'C:\Users...\';
datFiles = dir([folder,'\*.DAT']);
numfiles = length(datFiles);
for k = 1:numfiles
myfunction(datFiles(k).name);
end
end
Thanks

回答 (1 件)

KSSV
KSSV 2018 年 5 月 24 日
There is a option to switch on/ allow multiple files select in uigetfile. Read the documentation properly.
[files, pathname,]=uigetfile('directory','*.txt','Multiselect','on');
  1 件のコメント
Isma_gp
Isma_gp 2018 年 5 月 24 日
Hi, yes I've seen this, I can select several files, but the function will not go through all the files.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by