Info

This question is closed. Reopen it to edit or answer.

using a function to input names of files

2 views (last 30 days)
fima v
fima v on 19 Feb 2017
Closed: MATLAB Answer Bot on 20 Aug 2021
i have a function that make operations on files that end with a-0 so i used dir command.
sad=dir('* a-0.txt');
i want it to return 4 arrays of the proccessed result, how to present the signature in that case ,i am not sure because its a special file name case. thanks.
  1 Comment
Walter Roberson
Walter Roberson on 19 Feb 2017
Do your file names have a space before the a-0.txt ?

Answers (1)

Walter Roberson
Walter Roberson on 19 Feb 2017
sad = dir('*a-0.txt');
sad_files = {sad.name};
nfile = length(sad_files);
for K = 1 : nfile
data{K} = readtable(sad_files{K});
end

This question is closed.

Community Treasure Hunt

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

Start Hunting!