list all the files of certain type in directory and put them in a variable

32 次查看(过去 30 天)
How do I put all files of certain type in a directory and put them in variable
eg. if my directory has 2 images new.jpg and tell.jpg
I want in matlab
a(1)=new.jpg a(2)=tell.jpg
automatically without me having to hardcode it in..

采纳的回答

Thomas
Thomas 2012-6-4
I guess you will have more processing to do after getting all the file names in matlab. Here is a wonderful example on how to process a sequence of file sin MATLAB
else if you just want the names of jpg files in a variable
try
a=dir('*.jpg')
a(1,1).name
a(2,1).name

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Search Path 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by