Split 3d array into 'i' equal mat files
Show older comments
Hello All,
I have a matrix (called my_matrix) which is of size() 256 x 6 x 2000. Could you please let me know how to split this array into six separate .mat files (or some other easier way) each having 256 x 1 x 2000? I tried using for loop as below but it didn't work out.
for i = 1:6
filename[i] = 'my_data[i].mat';
save(filename[i],'my_matrix(:,i,:)';'-mat');
end
Thanks! \ksnf3000
Accepted Answer
More Answers (1)
Azzi Abdelmalek
on 21 Mar 2016
Edited: Azzi Abdelmalek
on 21 Mar 2016
v=rand(4,6,8)
for ii= 1:6
filename=sprintf('my_data%d.mat',ii);
s=v(:,ii,:)
save(filename,'s');
end
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!