concatenating several mat file into one
14 次查看(过去 30 天)
显示 更早的评论
Hi,
I have several mat file like: first.mat ,second.mat ,third.mat,...
all of these files have the same content like: variable1<3400x1 double> , variable2<1143x1 double> , variable3<1141x1 double> , ...
all mat files have the same content but the size of each variable in each mat file is different. I need to concatenate all same variables in all mat files in order to have just one mat file.
can somebody tell me what can I do?which function should I use?
Many thanks.
0 个评论
采纳的回答
dpb
2014-4-13
Presuming by "math" files you mean a Matlab .mat file,
d=dir('*.mat'); % get the list of files
x=[]; % start w/ an empty array
for i=1:length(d)
x=[x; load(d(i).name)]; % read/concatenate into x
end
save('newfile.mat',x)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!