特定のフォルダへmatファイルを保存する方法

31 visualizaciones (últimos 30 días)
Taito Kinoshita
Taito Kinoshita el 12 de Ag. de 2020
Comentada: Taito Kinoshita el 13 de Ag. de 2020
以下のようなループ処理の中で繰り返し番号付きのmatファイルを作ったのですがこのmatファイル群を特定のフォルダに入れるにはどうすればいいでしょうか。
フォルダはすでに作ってあり、フォルダ名は「C」とします。
rootname = 'A_';
extension = '.mat';
for k=1:5
B(:,1) = 1+k;
B(:,2) = k-1;
data=B;
filename = [rootname, num2str(k), extension]; % ファイル名の作成
save(filename,'data',) % ファイルへの保存
end

Respuestas (1)

Kojiro Saito
Kojiro Saito el 12 de Ag. de 2020
シンプルにcopyfilemovefileを使ってファイルコピー・移動させたら良いと思います。
下記のコマンドで、A_*.matファイル群をサブフォルダーCに移動させます。
movefile A_*.mat C
  1 comentario
Taito Kinoshita
Taito Kinoshita el 13 de Ag. de 2020
なるほど!
ありがとうございます!

Iniciar sesión para comentar.

Categorías

Más información sobre 環境と設定 en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!