Borrar filtros
Borrar filtros

Open multiple file as string

3 visualizaciones (últimos 30 días)
Fredic
Fredic el 10 de Abr. de 2020
Comentada: Fredic el 20 de Abr. de 2020
Hi guys,
I have a question.
I have different file like string, and I want to open it togheter, without write the name
I tryd this code, but in this way I have to write the name of single file.
Have you advice about it?
directory='D:\Documents\numeric\pip\';
fittingresultspath = 'D:\Documents\numeric\fitting_results\pip\';
fid = -1; msg = ''; while fid < 0
disp(msg); filename = input('input: ','s'); fid=1;
end
Thank you so much
  8 comentarios
Geoff Hayes
Geoff Hayes el 11 de Abr. de 2020
Are all of the files in the same folder (see dir)? Different folders? Do you want the user to choose the file (see uigetfile)?
Fredic
Fredic el 12 de Abr. de 2020
The files are in the same folder and I want to consider all the files and not choose individual files.

Iniciar sesión para comentar.

Respuesta aceptada

Geoff Hayes
Geoff Hayes el 13 de Abr. de 2020
FC - try the following
folderName = '/Users/somename/somepath'; % example folder that has files we are interested in
filesInFolder= dir(folderName);
for k = 1:length(filesInFolder)
fprintf('file name: %s\n',filesInFolder(k).name);
% do something with this file
end
  8 comentarios
Fredic
Fredic el 20 de Abr. de 2020
thanks!!
Fredic
Fredic el 20 de Abr. de 2020
"Accept this answer at the top of the answer to actually accept it." It does not appers this possibility

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by