Hi, I'm trying to upload mutliple files into matlab but they are qxf files and I am struggling.

3 views (last 30 days)
I have the code;
Series1=qxf2mat('c1.qxf','-S')
to upload each file individually, and;
numfiles = 20;
mydata = cell(1, numfiles);
for k = 1:numfiles
myfilename = sprintf('file%d.txt', k);
mydata{k} = importdata(myfilename);
end
as an example way to import multiple text files but i'm not sure how to combine the two so that it works. My files are named from c1 - c75.
Thank you for any help you give,
Alexandra

Answers (1)

Stephen23
Stephen23 on 2 Aug 2016
Edited: Stephen23 on 2 Aug 2016
I will assume that the function qxf2mat imports the files correctly (it is a third party file, and downloading it requires registering. Apparently it imports the files as a structure). In that case you basically need to replace the importdata function with qxf2mat:
numfiles = 75;
mydata = cell(1,numfiles);
for k = 1:numfiles
myfilename = sprintf('c%d.qxf', k);
mydata{k} = qxf2mat(myfilename,'-S');
end
out = [mydata{:}]; % convert the cell array into a non-scalar structure
But I would recommend that you use dir:
S = dir('c*.qxf');
N = numel(S);
out = cell(1,N);
for k = 1:N
out{k} = qxf2mat(S(k).name,'-S');
end
out = [out{:}];
And read this to know how to access the imported data:

Community Treasure Hunt

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

Start Hunting!