Create folders in matlab and move into files via loop
8 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am making via a loop 4 .txt files. I would like to create 4 files and move each one of 4.txt files in these 4 folders (I mean each folder would have one .txt files).
How could I make it?
0 件のコメント
回答 (1 件)
Sai Sri Pathuri
2020 年 5 月 30 日
You may try the following
for i =1:4
currentFolder = sprintf('Folder%d',i);
mkdir(currentFolder)
cd(currentFolder)
fileID = fopen('FileName.txt','w');
% Write to file
cd ..
end
6 件のコメント
Sai Sri Pathuri
2020 年 6 月 1 日
Yes, you may replace dlmwrite with writematrix
writematrix(M,'final.txt','Delimiter','tab')
Refer the below links for replacing dlmwrite and dlmread with writematrix and readmatrix respectively
参考
カテゴリ
Help Center および File Exchange で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!