Save workspace with same load file name
5 ビュー (過去 30 日間)
古いコメントを表示
How to save matlab workspace automatically with same load file name? Thank you
採用された回答
Rik
2020 年 12 月 14 日
You can use code like this in a loop.
file_name_including_dot_txt='example.txt';
data=function_that_reads_your_file(file_name_including_dot_txt);
[p,fn]=fileparts(file_name_including_dot_txt);
matfilename=fullfile(p,[fn '.mat']);
save(matfilename,'data')
2 件のコメント
Little Flower
2022 年 4 月 28 日
Hello Rik, if I want to save it in a folder how can i change the last line of your code? kindly clarify
Rik
2022 年 4 月 29 日
Edit the second to last line. That is where the location and file name is determined. What exactly do you mean by saving in a folder?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で File Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!