moving files from one folder to an other

35 ビュー (過去 30 日間)
Habtamu Tesfaw
Habtamu Tesfaw 2019 年 3 月 8 日
編集済み: dpb 2019 年 3 月 8 日
Given two folder A ansd B as shown;
A='/media/my_name/data'
B='/media/my_name/moved_files'
first I read files in path A as shown below
f_raw=dir(fullfile(A,'*.mat'));
now I want to move the 10th file in path A to path B.
I tried it in the ff way but ends up with error,
movefile(A/f_raw(10).name,B)
How can I move this file to path B by using scripts given above ?

採用された回答

dpb
dpb 2019 年 3 月 8 日
編集済み: dpb 2019 年 3 月 8 日
ix=10; % don't bury data inside code; use variables
movefile(fullfile(f_raw(ix).folder,f_raw(ix).name),B)
  1 件のコメント
Habtamu Tesfaw
Habtamu Tesfaw 2019 年 3 月 8 日
Thank you so much it works fine

サインインしてコメントする。

その他の回答 (1 件)

カテゴリ

Help Center および File ExchangeStandard File Formats についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by