Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to determine specific image is empty in a specific folder
Date: Fri, 19 Feb 2010 01:27:04 +0000 (UTC)
Organization: Astronautic Technology (M) Sdn Bhd
Lines: 73
Message-ID: <hlkpd8$dcl$1@fred.mathworks.com>
References: <hljmnq$933$1@fred.mathworks.com> <hljpfd$a28$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1266542824 13717 172.30.248.38 (19 Feb 2010 01:27:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 19 Feb 2010 01:27:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1083010
Xref: news.mathworks.com comp.soft-sys.matlab:609513

Thank Dave Robinson,

It finally work. but it need some modification as below

bandPath = 'C:\System\band files';
Filename = fullfile(bandPath, 'band2.JPG');

if(exist(Filename,'file'))
MyImage = imread(Filename);
imshow(MyImage);
else
warndlg('No file recorded!!!','!! Warning !!');
end

I finally to define in the GUI, if i click a button for band2.JPG, it will show the image, else it will display warning dialog. 

Thanks all




"Dave Robinson" <dave.robinson@somewhere.biz> wrote in message <hljpfd$a28$1@fred.mathworks.com>...
> "Zulkifli " <zulkifliaziz@yahoo.com> wrote in message <hljmnq$933$1@fred.mathworks.com>...
> > Hi all,
> > 
> > I try to use isempty, but i won't work. What i'm trying to do firstly to call the folder directory where images is stored using the following command
> > 
> > bandpath = 'C:\System\band files';
> > 
> > then i specify the image i want using the following command
> > 
> > bandFiles = dir(fullfile(bandpath, 'band2.JPG'));
> > 
> > Then i'm stuck. 
> > 
> > what i'm trying to do next is to use if-else statement.
> > 
> > where, if the 'band2.JPG' exist, the it will imshow('band2.JPG')
> > 
> > else 
> > 
> > warndlg('No file recorded!!!','!! Warning !!');
> > break;
> > 
> > end
> > 
> > the problem is that, i do not know how to write a code to justify that the band2.JPG 
> > exist. pls help. thanks
> 
> Something like
> % Define the Path to the File
> BandPath = 'C:\System\band files';
> 
> % Create the full Filename, including Directory
> Filename = fullfile(bandpath, 'band2.JPG');
> 
> % Check if the file exists
> if(EXIST(Filename,'file')
>     % Yes it exists
>     MyImage = imread(Filename);
>    
>     % Do things .....
> else
>     % No it doesn't exist
>     warndlg('No file recorded!!!','!! Warning !!');
> end
> 
> Warning I haven't tried this, but I believe something along these lines should give you what I understand you want
> 
> Regards
> 
> Dave Robinson
>