Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
How to delete object

Subject: How to delete object

From: Miroslav Pavelka

Date: 19 Apr, 2009 21:30:28

Message: 1 of 1

I have following problem:
I have some object connected trough events and listeners.
(i.e. object f2 send event and data to f3, object f3 has a listener,
process data and send to object f4 trough event, etc.) The classes are
F2,F3,F4, the objects in the workspace are f2,f3,f4...
The problem is, if I delete the last object, the object still does
appear somewhere in memory so I get following message.

Warning: Error occurred while executing callback:
Invalid or deleted object.
 > In F3>F3.handle_evnt2 at 674
   In F3>@(src,evnt)F3.handle_evnt2(obj,src,evnt) at 76
   In F2>F2.data_load at 84

Row 674 (F3): notify(obj,'indicators_all',event_struct(new_ind));
Row 76: (F3)
Row 84: (F2) notify(obj,'candles_all',event_row(;

I tried deleting object f4 like delete(f4) then clear f4, so the f4
variable appear nowhere, but nothing helped. The variable f4 still does
appear in memory somewhere.
What to do?

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us