From: ImageAnalyst on 30 Mar 2010 17:10 On Mar 30, 4:56 pm, "only " <only_love_...(a)yahoo.com> wrote: > what do u mean by FilePatternString? ------------------------------------------------------ That would be something like 'C:\myFolder\*.bmp' if, for example, you want a list of only files that had the bmp extension. Maybe you should take a look at this Gui template that simplifies all this stuff about browsing for a folder, loading up a listbox, and clicking on an image filename to display it: http://www.mathworks.com/matlabcentral/fileexchange/24224
From: Walter Roberson on 30 Mar 2010 17:16 only wrote: > ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message > <58ca9271-1290-4117-ae22-f8547ca18b41(a)31g2000vbq.googlegroups.com>... >> On Mar 30, 3:54 pm, "only " <only_love_...(a)yahoo.com> wrote: >> > i added a push button to gui and made it open aspecific folder .how >> can i display the content of this folder in listbox. >> > i need the function to do it. >> >> ------------------------------------ >> Use listOfFilenames=dir(yourFilePatternString) to get the list of >> filenames. >> Then use set(handles.lsitbox1, 'string', listOfFilenames) to load up >> the listbox. > > what do u mean by FilePatternString? For example, 'C:\Documents And Settings\Users\Only\Applications\Matlab\*.jpg' The * indicates that all .jpg files in the given directories are to be matched. Usually, though, control over the kind of files that are to be found is handled by passing additional parameters to uigetfile() . You would probably just pass the directory name you got returned from uigetdir(). Be sure, though, to check ischar() on the result of uigetdir(), because if the user canceled out of uigetdir() then the value returned will be a numeric 0 rather than a character string. Note: what will be returned by dir() will not be a list of file names: it will be a struct array, one field of which is called 'name'. As I posted in my complete function in response to your request, you can extract the file name strings using the form {DirStruct.name} where DirStruct here indicates the variable name that you saved the results of the dir() call into.
First
|
Prev
|
Pages: 1 2 Prev: Where to find the file cdna.tif for fractal compression? Next: classregtree node split order |