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

조회 수: 30 (최근 30일)
Taito Kinoshita
Taito Kinoshita 2020년 8월 12일
댓글: Taito Kinoshita 2020년 8월 13일
以下のようなループ処理の中で繰り返し番号付きの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

답변 (1개)

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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 環境と設定에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!