From: Kari on
Hi

I have a problem plotting to GUI axes in an outside function (in a different M file). This is what I have been trying to do.

In the GUI m file:

function plotButton_Callback(hObject, eventdata, handles)
% hObject handle to plotButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%get the current list of file names from the listbox

outsideFunction(handles);

and in another file outsideFunction.m:

function outsideFunction(handles)

x = 1:0.1:10;
y = 3x^2 - 2x +5;

axes(handles.myAxes)
plot(x,y);

I get: Error using ==> axes
Invalid object handle
From: Rune Allnor on
On 19 Feb, 08:40, "Kari " <skoe...(a)gmail.com> wrote:
> Hi
>
> I have a problem plotting to GUI axes in an outside function (in a different M file). This is what I have been trying to do.
....
> I get: Error using ==> axes
> Invalid object handle

Set a breakpoint at the line "axes(handles.myAxes)" in the
file outsideFunction.m. Run the GUI again. The program
should stop instead of executing the line at the breakpoint,
and leave control back to you.

Once you get that control, examine exactly what kind of
object the handles variable is, and if it contains the
expected data:

get(handles)

If not, trace back th eexecution stack and see where
things got tangled up.

There might be some debugging tutorials around. Search
the docs.

Rune

From: Kari on
Rune Allnor <allnor(a)tele.ntnu.no> wrote in message <f74112cc-a449-4a93-a33f-e8d2db8c953e(a)o3g2000yqb.googlegroups.com>...
> On 19 Feb, 08:40, "Kari " <skoe...(a)gmail.com> wrote:
> > Hi
> >
> > I have a problem plotting to GUI axes in an outside function (in a different M file). This is what I have been trying to do.
> ...
> > I get: Error using ==> axes
> > Invalid object handle
>
> Set a breakpoint at the line "axes(handles.myAxes)" in the
> file outsideFunction.m. Run the GUI again. The program
> should stop instead of executing the line at the breakpoint,
> and leave control back to you.
>
> Once you get that control, examine exactly what kind of
> object the handles variable is, and if it contains the
> expected data:
>
> get(handles)
>
> If not, trace back th eexecution stack and see where
> things got tangled up.
>
> There might be some debugging tutorials around. Search
> the docs.
>
> Rune


Found the issue... I used close(all); in the outsideFunction, thereby closing the GUI and all axes.
 | 
Pages: 1
Prev: ear detection
Next: KDD Cup data set