Azzera filtri
Azzera filtri

How can i open a list of files?

4 visualizzazioni (ultimi 30 giorni)
RADWAN A F ZEYADI
RADWAN A F ZEYADI il 31 Ago 2022
Risposto: Voss il 31 Ago 2022
Hi,
i am trying to convert some files by GUI from extension to another and i would like to have the converted file with same name of the original file for a list of files in the same directory?
any suggestions please,thanks in advance.

Risposte (1)

Voss
Voss il 31 Ago 2022
folder = 'Path\to\your\directory';
old_ext = '.txt'; % original extension
new_ext = '.dat'; % new extension
old_files = dir(fullfile(folder,['*' old_ext])); % files with extension old_ext in folder
old_names = fullfile(folder,{old_files.name}); % full-path names of those files
new_names = regexprep(old_names,[old_ext '$'],new_ext); % new file names with extension new_ext

Categorie

Scopri di più su Dialog Boxes in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by