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

Thread Subject:
Processing v1.0.4 in Matlab? (as a plotter)

Subject: Processing v1.0.4 in Matlab? (as a plotter)

From: Clark

Date: 5 Jan, 2010 18:07:04

Message: 1 of 5

Folks;

Last year I set out to wrap the Processing (http://www.processing.org/) graphics engine into Matlab as a way of plotting and also getting Matlab nearer to some wiring/arduino stuff I was working on.

I got pretty far. I embedded the Processing Java stuff into Matlab's java engine, over-rode Processing's base viewer object to interact with Matlab, plotted many plots, hundreds of times. Kinda cool.

But I came up against a wall I could not cross. I was able to access the Processing API directly from within Matlab (that's the golden egg), and felt I had had succeeded in the design and implementation. So prove it. I wrote a loop to generate 10,000 spectrogram plots of crazy random size, etc. But alas ... Matlab out of memory after 10-12 plots.

Blahst. (yes, Memory Leaks cost me more than a quarter once upon a time) All manner of attempted deletions, etc. Nothing worked. The only way to free the allocation seems to be to exit Matlab. So before I let inscription become epitaph so passively...

Does anyone have any interest in this project? (It's one heckuva nice way to plot from Matlab :) If so, I'll dust it off and post.

Cdog

Oh: Here's the thread about it over there: (http://processing.org/discourse/yabb2/YaBB.pl?num=1235791346)

Subject: Processing v1.0.4 in Matlab? (as a plotter)

From: Yair Altman

Date: 6 Jan, 2010 00:45:06

Message: 2 of 5

"Clark" <cdunson@gmail.com> wrote in message <hhvv48$60n$1@fred.mathworks.com>...
> Folks;
>
> Last year I set out to wrap the Processing (http://www.processing.org/) graphics engine into Matlab as a way of plotting and also getting Matlab nearer to some wiring/arduino stuff I was working on.
>
> I got pretty far. I embedded the Processing Java stuff into Matlab's java engine, over-rode Processing's base viewer object to interact with Matlab, plotted many plots, hundreds of times. Kinda cool.
>
> But I came up against a wall I could not cross. I was able to access the Processing API directly from within Matlab (that's the golden egg), and felt I had had succeeded in the design and implementation. So prove it. I wrote a loop to generate 10,000 spectrogram plots of crazy random size, etc. But alas ... Matlab out of memory after 10-12 plots.
>
> Blahst. (yes, Memory Leaks cost me more than a quarter once upon a time) All manner of attempted deletions, etc. Nothing worked. The only way to free the allocation seems to be to exit Matlab. So before I let inscription become epitaph so passively...
>
> Does anyone have any interest in this project? (It's one heckuva nice way to plot from Matlab :) If so, I'll dust it off and post.
>
> Cdog
>
> Oh: Here's the thread about it over there: (http://processing.org/discourse/yabb2/YaBB.pl?num=1235791346)


Try setting turb=[]; before clearing turb. This might enable better garbage collection by explicitly releasing the Java reference.

Also, try calling java.lang.System.gc(); directly (yes I know that in theory this should not be necessary and should not be done...).

Also, try reusing the same figure window to redraw, instead of trying to recreate a new window - Matlab keeps old figure frames hidden which may cause the effect you see. Alternately, search and destroy hidden remnants using java.awt.Frame.getFrames() and its relatives.

As a final alternative, try using the alternative excellent JFreeChart open-source charting library ( www.jfree.org ), which has a much wider support base AFAIK. There are several Matlab developers using it, as evidenced by a few CSSM queries over the years.

Yair Altman
http://UndocumentedMatlab.com

Subject: Processing v1.0.4 in Matlab? (as a plotter)

From: Clark

Date: 6 Jan, 2010 01:58:04

Message: 3 of 5

Yair!!!

Did not think to be finding help, really appreciate!
This might incentivize me to finish stomping this out
although I am a couple of new machines and OS/SW
versions later ... (Almost an exhumation)

THANK YOU! I'll bump this, etc. if anything develops

Subject: Processing v1.0.4 in Matlab? (as a plotter)

From: Christina

Date: 17 Mar, 2010 20:20:25

Message: 4 of 5

Hi,

I would be interested in playing with Processing and Matlab if you're interested in dusting it off . . .



"Clark" <cdunson@gmail.com> wrote in message <hi0qnc$acl$1@fred.mathworks.com>...
> Yair!!!
>
> Did not think to be finding help, really appreciate!
> This might incentivize me to finish stomping this out
> although I am a couple of new machines and OS/SW
> versions later ... (Almost an exhumation)
>
> THANK YOU! I'll bump this, etc. if anything develops

Subject: Processing v1.0.4 in Matlab? (as a plotter)

From: Pete

Date: 26 Mar, 2010 11:05:07

Message: 5 of 5

very, very interesting.

Do post again if/when there are any developments. Could be onto something pretty neat here.

Tags for 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