DSPRelated.com
Forums

how do i get MATLAB 5 to export a "Figure" to PNG or SVG?

Started by Unknown August 18, 2006
<rbj@audioimagination.com> schrieb 
> and can go to the menu and "Copy Figure" and paste it into > Micro$hit Word, but i can't find a way to export that to .png > or .svg either.
You have solved your problem in the meantime, but for other times you might try to do a PS/EPS file and then convert it with Ghostscript.
> i'm trying to upload some math function graphs into Wikipedia > and i can't, for the life of me, figger out gnuplot.
Where does gnuplot come into the play? Anyway, here is quite a good reference to this excellent program: http://t16web.lanl.gov/Kawano/gnuplot/intro/index-e.html BTW, my approximation to your original problem with gnuplot: *************************************** set terminal table set print "rbj.table" f(x)=cos(pi*x) print -4, f(-4) print -3, f(-3) print -2, f(-2) print -1, f(-1) print 0, f( 0) print 1, f( 1) print 2, f( 2) print 3, f( 3) print 4, f( 4) set terminal png set output "rbj.png" plot [-4:4] cos(pi*x), \ cos(pi*x+pi/4)/cos(pi/4), \ cos(pi*x-pi/3)/cos(-pi/3), \ "rbj.table" with points pointtype 3 pointsize 2 *************************************** This is admittedly a bit round-about, but it works. Gnuplot-gurus might improve on that one, I'm sure. HTH Martin
<rbj@audioimagination.com> schrieb 
> and can go to the menu and "Copy Figure" and paste it into > Micro$hit Word, but i can't find a way to export that to .png > or .svg either.
You have solved your problem in the meantime, but for other times you might try to do a PS/EPS file and then convert it with Ghostscript.
> i'm trying to upload some math function graphs into Wikipedia > and i can't, for the life of me, figger out gnuplot.
Where does gnuplot come into the play? Anyway, here is quite a good reference to this excellent program: http://t16web.lanl.gov/Kawano/gnuplot/intro/index-e.html BTW, my approximation to your original problem with gnuplot: *************************************** set terminal table set print "rbj.table" f(x)=cos(pi*x) print -4, f(-4) print -3, f(-3) print -2, f(-2) print -1, f(-1) print 0, f( 0) print 1, f( 1) print 2, f( 2) print 3, f( 3) print 4, f( 4) set terminal png set output "rbj.png" plot [-4:4] cos(pi*x), \ cos(pi*x+pi/4)/cos(pi/4), \ cos(pi*x-pi/3)/cos(-pi/3), \ "rbj.table" with points pointtype 3 pointsize 2 *************************************** This is admittedly a bit round-about, but it works. Gnuplot-gurus might improve on that one, I'm sure. HTH Martin
Martin Blume wrote:
> <rbj@audioimagination.com> schrieb > > and can go to the menu and "Copy Figure" and paste it into > > Micro$hit Word, but i can't find a way to export that to .png > > or .svg either. > You have solved your problem in the meantime, but for other > times you might try to do a PS/EPS file and then convert it > with Ghostscript. > > > > i'm trying to upload some math function graphs into Wikipedia > > and i can't, for the life of me, figger out gnuplot. > Where does gnuplot come into the play?
that's what the folk at Wikipedia recommend. it looks like Octave uses gnuplot (i've downloaded it) and i think i can figger out Octave. dunno why anyone buys MATLAB anymore. r b-j
"robert bristow-johnson" <rbj@audioimagination.com> wrote in message 
news:1156005986.356171.312010@p79g2000cwp.googlegroups.com...

Randy Yates wrote:
> "robert bristow-johnson" <rbj@audioimagination.com> writes: > > > Randy Yates wrote: > >> rbj@audioimagination.com writes: > >> > >> > and can go to the menu and "Copy Figure" and paste it into Micro$hit > >> > Word, but i can't find a way to export that to .png or .svg either. > >> > i'm trying to upload some math function graphs into Wikipedia and i > >> > can't, for the life of me, figger out gnuplot. > >> > >> In Matlab, after plotting the figure, enter in the command window: > >> print -dpng 'prob3ef.eps' > > > > oooh, oooh, i have to try that. i'll report how this undocumented > > feature works. i presume it should be 'prob3ef.png' instead of > > 'prob3ef.eps'. i did see something like this for eps, but i couldn't > > believe this PC with micro$hit office couldn't even deal with > > encapsulated postscript. > > From what I've seen, EPS and MicroSnot Office aren't good friends. > MicroSnot > much prefers things like jpegs, bmps, wmf's, etc. EPS requires a (gasp!) > postscript interpreter.
bad news. (maybe it's because it's MATLAB 5 and not 6 or 7.) *snip* FYI, scanning our product archives and testing out a few things, it looks like exporting to PNG using the -dpng flag was introduced in MATLAB 5.3 (R11), which shipped in March of 1999. I was able to export to PNG using this version. -- Steve Lord slord@mathworks.com