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!