Borrar filtros
Borrar filtros

ディレクトリ 変更 ループ

6 visualizaciones (últimos 30 días)
Ukasu
Ukasu el 17 de En. de 2020
Respondida: Kenta el 17 de En. de 2020
日付ごとのフォルダがあり、フォルダごとに同じ作業を繰り返したいのですが、どうすればいいですか。
たとえばA,B,Cという3つのディレクトリがあり,下のようにそれぞれのディレクトリで同じ作業を行いたいです。
sdir = ['A','B','C'];
for n=1:3
cd sdir(n)
% 何かしらの作業。例えば、
I=dir('*.jpg');
size(I);
end

Respuesta aceptada

Kenta
Kenta el 17 de En. de 2020
sdir = ['a','b','c'];
for n=1:3
cd(sdir(n))
I=imread('onion.png');
size(I)
cd ../
end
こんにちは、この例だと、cd ../でディレクトリをもとに戻し、さらにcdで、フォルダに入り、作業...という流れですれば可能です。

Más respuestas (0)

Categorías

Más información sobre 検索パス en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!