Path: news.mathworks.com!not-for-mail
From: "Alexander " <airkemp@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Using Array data to read in Images
Date: Sun, 19 Apr 2009 19:03:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 46
Message-ID: <gsfsh6$4lb$1@fred.mathworks.com>
References: <gsfnr6$5e9$1@fred.mathworks.com> <gsfr0d$qke$1@fred.mathworks.com>
Reply-To: "Alexander " <airkemp@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1240167782 4779 172.30.248.35 (19 Apr 2009 19:03:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 19 Apr 2009 19:03:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1549321
Xref: news.mathworks.com comp.soft-sys.matlab:533890


"Jiro Doke" <jiro.doke@mathworks.com> wrote in message <gsfr0d$qke$1@fred.mathworks.com>...
> "Alexander " <airkemp@gmail.com> wrote in message <gsfnr6$5e9$1@fred.mathworks.com>...
> > Hi,
> > 
> > I have an array in matalb called IMAGESDATA, each cell in the array holds two values; name and path, so for example "IMAGESDATA(1,1).name" = doneB.jpg and "IMAGESDATA(1,2).path" = C:\....... The array holds the details for 4 images.
> > I want to read in each of the images in seperatly using their path and name in the IMAGESDATA array.
> > so along the lines of:
> > 
> >      function Getimages(handles)
> >      global IMAGESDATA;
> >           
> >      A = (imread ( IMAGESDATA(1,2) + IMAGESDATA(1,1) ));
> >      B = (imread ( IMAGESDATA(2,2) + IMAGESDATA2,1) ));
> >      C = (imread ( IMAGESDATA(3,2) + IMAGESDATA(3,1) ));
> >      D = (imread ( IMAGESDATA(4,2) + IMAGESDATA(5,1) ));
> > 
> > Is there anyway of doing this?, do i need to put it in a function?,  can anyone help?
> > 
> > Many Thanks
> > 
> > Alex
> 
> Alex,
> 
> There are some inconsistencies in the way your described your problem. Do you have a cell array or an array of structures? "IMAGESDATA(1,1).name" is a syntax you use for structures. But then, I'm not sure why you don't have the path also stored in the (1,1) index, as in "IMAGESDATA(1,1).path".
> 
> So I'm just going to give you a general answer. If FILENAME contains the name of the file and PATHNAME contains the name of the path, you can create the full path to the file like this:
> 
> fullfile(PATHNAME, FILENAME)
> 
> Then pass that into IMREAD:
> 
> imread(fullfile(PATHNAME, FILENAME))
> 
> 
> Hope this helps.

Hi Jiro, Thanks for getting back.

Applogies, IMAGESDATA is an array of structures, each structure within the array has 2 fields, path and name so IMAGESDATA(1,1) has a path field and a name field, IMAGESDATA(1,2) has a different path field and a name field so i need a way of access each individual field if possible.

any ideas?

Thanks

Alex