From: ImageAnalyst on
guidata says this:
"GUIDE Uses guidata GUIDE uses guidata to store and maintain the
handles structure. From a GUIDE-generated GUI M-file, do not use
guidata to store any data other than handles. If you do, you may
overwrite the handles structure and your GUI will not work. If you
need to store other data with your GUI, you can add new fields to the
handles structure and place your data there. See GUI Data in the
MATLAB documentation."

Yeah, I know - it's ambigous. First it tells you not to store stuff
like your image array (which is just a regular variable not a handle),
and then it says that you can. Clear as mud. They should really
clear that wording up. Well here's my understanding of what goes on
(which may be wrong):

imgfinal is not a property of any gui control is it? Despite the fact
that you may display it in an axes on a gui, it's not a gui control
property, like, say, the value property of the scroll bar is, or the
value property of a checkbox. So I think calling guidata does nothing
as far as imgfinal goes. It has no idea what to do with imgfinal
since it's not gui data - it's not a property of a control, it's just
some variable that you tacked on to the handles structure hoping to
make it a global variable that would get transported around everywhere
handles goes. But I don't think that's the case. Once your first
routine exits (after the useless call to guidata), any changes you
made to handles are lost - they're like local variables. I believe
the proper way to do this would be to call setappdata() (where you
make the variable in routine #1) and then getappdata() (where you need
to use the variable in routine #2), rather than attaching it to the
handles structure. Those two routines were made especially for this
purpose.

I could be wrong but that's my understanding of it.

With non-callback routines, I pass handles in to the function and
return it out so that any changes I make to handles are then seen by
the calling routine.

Good luck,
ImageAnalyst
From: ImageAnalyst on
guidata help also says this:
"guidata(object_handle,data) stores the variable data as GUI data. If
object_handle is not a figure handle, then the object's parent figure
is used. data can be any MATLAB variable, but is typically a
structure, which enables you to add new fields as required."
so it could be that you just reversed your arguments and it should be
like this
guidata(handles, handles.imgfinal);

However if you do that (use guidata to store an image array), you're
risking this:
"From a GUIDE-generated GUI M-file, do not use guidata to store any
data other than handles. If you do, you may overwrite the handles
structure and your GUI will not work." (From the documentation for
guidata)
Hence my earlier suggestion to use get/setappdata() which I believe is
the preferred way. Global variables are also another option.
From: Suchita on
hey but this one also not working................

ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <407f4d78-ec4e-4455-bb14-1be7ebbbd9fe(a)v36g2000yqv.googlegroups.com>...
> guidata help also says this:
> "guidata(object_handle,data) stores the variable data as GUI data. If
> object_handle is not a figure handle, then the object's parent figure
> is used. data can be any MATLAB variable, but is typically a
> structure, which enables you to add new fields as required."
> so it could be that you just reversed your arguments and it should be
> like this
> guidata(handles, handles.imgfinal);
>
> However if you do that (use guidata to store an image array), you're
> risking this:
> "From a GUIDE-generated GUI M-file, do not use guidata to store any
> data other than handles. If you do, you may overwrite the handles
> structure and your GUI will not work." (From the documentation for
> guidata)
> Hence my earlier suggestion to use get/setappdata() which I believe is
> the preferred way. Global variables are also another option.
From: Suchita on
"Suchita " <suchitamanandhar(a)hotmail.com> wrote in message <h7q018$13t$1(a)fred.mathworks.com>...
> hey but this one also not working................I didnt get using setappdata or getappdata ?? How do we use those controls to share the same image variable between callbacks ?

>
> ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <407f4d78-ec4e-4455-bb14-1be7ebbbd9fe(a)v36g2000yqv.googlegroups.com>...
> > guidata help also says this:
> > "guidata(object_handle,data) stores the variable data as GUI data. If
> > object_handle is not a figure handle, then the object's parent figure
> > is used. data can be any MATLAB variable, but is typically a
> > structure, which enables you to add new fields as required."
> > so it could be that you just reversed your arguments and it should be
> > like this
> > guidata(handles, handles.imgfinal);
> >
> > However if you do that (use guidata to store an image array), you're
> > risking this:
> > "From a GUIDE-generated GUI M-file, do not use guidata to store any
> > data other than handles. If you do, you may overwrite the handles
> > structure and your GUI will not work." (From the documentation for
> > guidata)
> > Hence my earlier suggestion to use get/setappdata() which I believe is
> > the preferred way. Global variables are also another option.
From: ImageAnalyst on
On Sep 3, 11:03 pm, "Suchita " <suchitamanand...(a)hotmail.com> wrote:
> hey but this one also not working................
----------------------------------------------------------------------
Hmmmm.... global variables and getappdata both not working? How
strange.
I suggest you call The Mathworks technical support for assistance.
They can talk you through it. Perhaps you need to reinstall.