Code covered by the BSD License  

Highlights from
matlabfrag to pdf

4.66667

4.7 | 3 ratings Rate this file 40 Downloads (last 30 days) File Size: 2.98 KB File ID: #28545

matlabfrag to pdf

by

 

25 Aug 2010 (Updated )

Small script using matlabfrag to create a latex formatted pdf file.

| Watch this File

File Information
Description

Based on plotpdftex

Calls matlabfrag to create the *.eps and *.tex Files. After that pdflatex is used to create the pdf File.

    USAGE:
    ------------------------

    mlf2pdf creates the PDF file of the current graphical figure (CGF)
    named LaTeXfile.pdf
 
    mlf2pdf(H) creates the PDF file from the graphical figure with
    handle H, named LaTeXfile.pdf
    
    mlf2pdf(H,FILENAME) creates the PDF file from the graphical figure
    with handle H, named FILENAME.PDF (FILENAME is a character array of
    the filename, with or without the extension .PDF)
   
    mlf2pdf(H,FILENAME,PACKAGES) to adding
    packages such as fonts, mathfont,...
    ex: PACKAGES = 'amssymb, times'

It now supports Windows AND Unix Systems.

Acknowledgements

Plot Pdf Tex and Matlabfrag inspired this file.

This file inspired Latexfigure and Huygens Fresnel Integral Approximation, Free Form Apertures And Rough Surfaces.

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (10)
06 Oct 2011 Ralf

Oh, that's no problem tobsen. You were quicker than I. What you just figured out by yourself I wanted to suggest you.

You not need to set the interpreter, because mlf2pdf is using pdflatex anyway.

Have fun with Matlab and LaTeX.

Ralf

06 Oct 2011 tobsen

UPDATE -----

Just found out it works with

xlabel('Flow ($m^3/s$)','Interpreter','Tex');

or

xlabel('Flow ($m^3/s$)','Interpreter','LaTex');

Sorry for wasting your time :)

06 Oct 2011 tobsen

Thanks Ralf for the quick reply, I'm rather new to Matlab, so maybe I did something wrong, but the code that doesn't work is this:

% plot water level over flow (Q)
Q = 200:100:50000;
h = zeros(498,1);
j = 1;
for i=200:100:50000
h(j) = river_stage(i);
j = j + 1;
end

figH=figure;
plot(Q,h);
xlabel('Flow (m³/s)');
ylabel('Stage (m above sea level)');
colormap summer;

mlf2pdf(figH,'rating-curve');

Regards,
Tobsen

05 Oct 2011 Ralf

Hi tobsen,

it is difficult to say what went wrong in your example. Could you please post the relevant code? Do you use $$-enviroment? For me, superscripts work perfectly.

Regards,
Ralf

05 Oct 2011 tobsen

Good work! There is a problem with superscript letters though. I was trying to plot a graph with 'Hm³' in the x-axis text and couldn't get the export to run. I have no idea how to fix this, but I thought it would be nice if someone did.

29 Mar 2011 David

I added the location using file set path. Everything is working perfectly now. Thanks

28 Mar 2011 Ralf

Hi David! I had a similar issue, when I moved my scripts from my Ubuntu machine to Mac OS X. I guess mlf2pdf do not find pdflatex on your machine.

At that time Walter Robertson helped me with this problem.

http://www.mathworks.com/matlabcentral/answers/850-matlab-environment-variables

This solution is for a Unix OS, but for Windows you also have set the path for pdflatex in the startup.m file.

Good luck!

Ralf

28 Mar 2011 David

I dont know if this is the correct place to ask questions, but...

I had mlf2pdf running on my old machine and have recently upgraded to win7 64bit. Now when I call mlf2pdf it goes through the motions and i see the eps and tex file being generated but the pdf file never materializes despite the output from mlf2pdf being good.

Has anyone else experienced this?

08 Feb 2011 Ralf  
14 Sep 2010 Martin

Thanks to Ralf for the UNIX commands...

Updates
25 Aug 2010

added acknowledgements

03 Sep 2010

mlf2pdf ignored the figure handle. Should work now.

14 Sep 2010

+ added UNIX Support
+ included an example

Contact us