Separate matrix each 3 columns and save outputs each iteration
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I have two issues:
I got a 30x90 matrix to be saparated every 3 columns each for loop iteration and save the each output into different files with different names in csv format.
Many thanks to those who can help me!
0 个评论
采纳的回答
Jan
2022-6-7
编辑:Jan
2022-6-7
With some bold guessing, what "different names" means (better mention, what you want):
data = reshape(1:30*90, 30, 90); % Some test data
blocks = reshape(data, 30, 3, 30);
% Now blocks(:, :, k) is the k.th block of 3 columns
folder = 'D:\Your\Folder';
for k = 1:30
Block = blocks(:, :, k);
file = sprintf('File%02d.mat', k);
csvwrite(fullfile(folder, file), Block);
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!