|
"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
|