summing every twelve files from multiple .mat files
显示 更早的评论
Hi everyone,
I am new to Matlab. This may look trivial. I have thousands .mat matrix files of size K(180, 360). I want to do two things:
- Read these files and summing every twelve files
- Clip the result from size (180, 360) to something like (100,100)
- save the results
This is what I have done:
dirname = uigetdir;
Files = dir(fullfile(dirname,'*.mat'));
Total = zeros(180,360);
N=length(Files);
for k=1:N
ppm.Frame=load(Files(k).name)); % read the files
while k<= 12;
Total = Total + pp.Frame % do the summing of first twelve files here
k = k+1;
else
k=0;
% How do I resize the result here?
save(Total)
clear Total
end
Help would be highly appreciated.
1 个评论
Jan
2015-4-6
What exactly is "K(180, 360)"? How can files be added? Do you mean that the MAT-files contain a variables called "K", which has the size [180 x 360]? And you want to create the sum over these values? How is "every 12 files" defined? In alphabetical order? How should the clipping be applied exatcly? Do you want to remove the right, left, upper, lower rows and columns?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Workspace Variables and MAT Files 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!