How to extract specific images from a library of images?

1 回表示 (過去 30 日間)
oshawcole
oshawcole 2019 年 8 月 20 日
編集済み: Stephan 2019 年 8 月 20 日
I have a folder which has 600 images, the images are named as 10000, 10001, 10002,... I have an excel file which has the information about the image number of interest. For example, I want image number 0,3,8,12,16,224 etc to be extracted from this library. How do I go about executing that? Any help would be appreciated.

採用された回答

Stephan
Stephan 2019 年 8 月 20 日
編集済み: Stephan 2019 年 8 月 20 日
You can construct a string array of the desired file names like follows:
exceldata = [0,3,8,12,16,224];
filenames = string(10000 + exceldata)';
fileending = repelem(".jpg", numel(filenames), 1);
files = join([filenames fileending],"");
folder = repelem("C:\MyData\YourFolderName\", numel(filenames), 1);
fullFileNames = join([folder files],"")
in this exampe the result is:
fullFileNames =
6×1 string array
"C:\MyData\YourFolderName\10000.jpg"
"C:\MyData\YourFolderName\10003.jpg"
"C:\MyData\YourFolderName\10008.jpg"
"C:\MyData\YourFolderName\10012.jpg"
"C:\MyData\YourFolderName\10016.jpg"
"C:\MyData\YourFolderName\10224.jpg"
This result can be used to copy or move the files by looping through this string array.
Best regards
Stephan
  6 件のコメント
oshawcole
oshawcole 2019 年 8 月 20 日
Thank you so much.
Stephan
Stephan 2019 年 8 月 20 日
編集済み: Stephan 2019 年 8 月 20 日
This comment makes me assume it worked for you ;-)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by