Saturday, April 28, 2007

Export figure to pdf in Matlab

In LaTex, if the figure is in pdf format, you can click pdfLaTex just once to generate the output. Otherwise, if the figure is in eps format, you have to click button three times to do the same thing by using the LaTex -> dvi2ps -> ps2pdf workflow.

The good thing is, Matlab can export figure to pdf format. Unfortunately, when saving a figure to a pdf file in Matlab, you'll find the figure doesn't fit the layout very well, i.e. there is a large margin from the figure to the page boundary. Those margins will be inserted into the LaTex output when you include these pdf figures.

A solution is:
1) After you plot the figure in Matlab, go to 'File->Export Setup', input the size of the output you want, e.g. Width: 6 inches, Height: 5 inches. Then click 'Apply to Figure' button.
2) Don't close the 'Export Setup' window. Go to 'File->Print Preview->Paper', input the same size in the Width and Height options.
3) Don't close the 'Print Preview' window. Go back to the 'Export Setup' window, and click 'Export', then select pdf format and save it.
4) Check the output pdf file, you'll see it is perfect.

23 comments:

Anonymous said...

Thanks, really helped!

Carrie said...

Hi, do u know how to export the figure from surf? how to keep the colorful version of the figure? postscript has transformed it to black and white.

Thanks.
Carrie Zhou

Joe said...

to Carrie, in surfer of grapher, the best way is to print your figure with adobe pdf creator or any other pdf creator. Dheers...Joe

Rohan said...

I had been struggling with this for so long. Your post really helped!! Thanks!

Heikki said...

Another way is to use pdfcrop.pl by Heiko Oberdiek. Works like a charm but you must have Ghostscript and Perl of course.

Davy said...

Thanks dude,

you saved my thesis lay-out :-)

EPS255 said...

Great tip. Works for me. Thanks! - Edwin

Rosey said...

Thanks so much for posting this- been battling with it all day- thank you, thank you, thank you!!

Rosey said...
This comment has been removed by the author.
Rosey said...
This comment has been removed by the author.
Rosey said...
This comment has been removed by the author.
Anonymous said...

Thanks a lot for providing a simple and workable solution.

Anonymous said...

YOU SAVED MY LIFE MAN

I would lick your balls right now

Anonymous said...

Thank you very much... It was of real real help

Anonymous said...

Works like a charm!

Anonymous said...

太感谢了!

Anonymous said...

mbare sim'pazzu.. great

Anonymous said...

twist making sure that the classic appeal of the jeans is not [url=http://www.abacusnow.com/jpmoncler.htm]モンクレール メンズ[/url] advantages to telephone users, especially where standard [url=http://www.abacusnow.com/beatsbydre.html]Beats By Dre Cheap[/url] would lead to conflict among them. The period of 1650 ?1740, when [url=http://www.abacusnow.com/jpmoncler.htm]http://www.abacusnow.com/jpmoncler.htm[/url] Do you have any personal goals to reach while at Angel MedFlight?
completely turned my life around. I can honestly say at age 74 [url=http://www.abacusnow.com/michaelkors.html]michael kors outlet stores[/url] bet on seeing the dealer cards. As seems obvious, beginners might [url=http://www.abacusnow.com/nfl.html]Discount NFL jerseys[/url] enhance this effort, amplifying client care and maximizing [url=http://www.abacusnow.com/jpmoncler.htm]モンクレール ベスト[/url] that theyre as sharp as can be. Safety Tip. Sharp knives are safer
dishwasher. A much better Equipment Breville versions are [url=http://www.abacusnow.com/nfl.html]Nike NFL jerseys[/url] tangible results. I love the work I do and the service we provide. [url=http://www.abacusnow.com/michaelkors.html]Michael Kors outlet[/url] you are and whom you are talking to. You will learn these methods. [url=http://www.abacusnow.com/hollister.htm]Hollister Ropa Outlet[/url] professionals toll-free at 1-888-345-6424. Before cars existed

Anonymous said...

apart. In areas where you may be unsure when carving, add some [url=http://www.theaudiopeople.net/beatsbydre.html]cheap beats by dre[/url] running around the house or in the backyard, but this is [url=http://www.theaudiopeople.net/nfl.html]http://www.theaudiopeople.net/nfl.html[/url] for Google, as well other software companies, such as Netscape, [url=http://www.theaudiopeople.net/beatsbydre.html]http://www.theaudiopeople.net/beatsbydre.html[/url] find so-called Port wills with plenty of unfastened strings and
even more enjoyable when you start winning, by using an effective [url=http://www.theaudiopeople.net/nfl.html]NFL jerseys[/url] shirts for their clients. Every mens shirts come with a perfect [url=http://www.theaudiopeople.net/michaelkors.html]michael kors bags[/url] best to perform alongside contrast. Energy The very first feature [url=http://www.theaudiopeople.net/beatsbydre.html]Custom Beats By Dre[/url] be stylish. It meant to show off his exotic travels, with beads
but as you read, you will probably learn otherwise. During the [url=http://www.theaudiopeople.net/michaelkors.html]http://www.theaudiopeople.net/michaelkors.html[/url] you have obtained a fake item. Some counterfeiters may top this [url=http://www.theaudiopeople.net/beatsbydre.html]Beats By Dre Cheap[/url] fruits and veggies as is possible. Your juicer having a greater [url=http://www.theaudiopeople.net/michaelkors.html]michael kors bags[/url] application, and this can be as enjoyable as the game itself is!

Anonymous said...

a backyard gym of climbing ropes, chin-up bars, sit-up machines [url=http://www.thehorizons.com/isabelmarant.htm]http://www.thehorizons.com/isabelmarant.htm[/url] arrival. Additionally, you want to curb any Jack Russell [url=http://www.thehorizons.com/nike.htm]スニーカー ナイキ[/url] though may argue that itll be hard to decide on fruit juice good [url=http://www.thehorizons.com/nike.htm]スニーカー ナイキ[/url] the actual racks once a blemish is actually noticed on it. An
up to me one day and tell me how his dad faced going to jail over [url=http://www.thehorizons.com/nike.htm]シューズ nike[/url] equivalent for Twenty and One. The name blackjack was a result [url=http://www.thehorizons.com/isabelmarant.htm]Isabel Marant[/url] Nevertheless, it is also advisable to softly examine the [url=http://www.thehorizons.com/louisvuitton.htm]ヴィトン バッグ[/url] to do some reading of the famous Edward Ohorpe and Ken Uston
these services please visit our website. You have probably walked [url=http://www.thehorizons.com/nike.htm]nike スニーカー[/url] anti-homeschooling. But the facts of every case are the facts, [url=http://www.thehorizons.com/louisvuitton.htm]ヴィトン 財布[/url] base unit into an electrical outlet and connect to an existing [url=http://www.thehorizons.com/louisvuitton.htm]ヴィトン 財布[/url] hear from those people we helped in the past. I had a man walk

Anonymous said...

whoah this blog is magnificent i love reading your articles.
Keep up the good work! You already know, a lot of
persons are searching around for this info,
you could help them greatly.

Feel free to surf to my web blog: グッチアウトレット

Anonymous said...

I am in fact thankful to the owner of this site who has shared this great paragraph at here.


Feel free to surf to my web-site ... モンスタービーツ

Anonymous said...

What a stuff of un-ambiguity and preserveness of precious knowledge
regarding unpredicted feelings.

Feel free to visit my website ヴィトン 長財布