FileTime
Get and set the times for creation, access and modification of a file or folder (Windows only)
Author: Jan Simon

Dear Jan,

Your function looks really promising, however I cannot compile the function, as matlab returns an error on the TzSpecificLocalTimeToSystemTime function. I am running matlab 7.5 on XP so this should support this functon.

Alternatively I commented out the error warning which uses this function. Now compilong works, however the function still return an error: 'SetFileTime: Time to FILETIME failed!' or ''Too many input paramters"

Finally, your precompiled dll's fixed the problem.

Thanks for this great contribution! I was looking for this functionality, and it works great!

@Eric I got around the error problem in finish.m by placing the history_preserved command in a try cath block. So finish.m will look like:

setpref('StartupDirectory','LastWorkingDirectory',pwd)
try
preserve_history;
catch EM
h=msgbox(EM.message,sprintf('Error: %s',EM.identifier),'error');
uiwait(h);
return
end

Now it won't 'hang' your matlab but just display an error dialog before closing.

I had a similar problem. Matlabs legend command does not really have correct positioning properties if the legend is outside the figure. I added some lines below the legend2latex function to adjust the position properties manually

See below for an example of how this file can be used. I noted that the figure_handle is different from the figure_handle as expected by LaPrint. I use a direct handle, where LaPrint uses the figure number.

Good luck,
Emile

%%%%% EXAMPLE %%%%%%
set(0,'defaulttextinterpreter','none');
x = [0:0.1:(2*pi)];
fig1 = figure(1);
plot(x,sin(x),x,cos(x));
legend('sin($\theta$)','cos($\theta$)');
xlabel('$0 \leq \theta \leq 2\pi$')
legend2latex(fig1);
laprint(1,'figure1');

30 Sep 2009

LaPrint
LaPrint prints a MATLAB figure to file for neat inclusion in LaTeX documents.
Author: Arno Linnemann

Great work! This script allowed me to perfectly markup all my figures, so they could be included nicely in my report. @Tor Aksel, I wrote a legend to latex converter to overcome the small box problem.

Really nice function. However, the font size in the legend is not preserved. This is easy to fix with something like
fontsize = get(legh,'FontSize');
...
set(legend_lbl, 'FontSize', fontsize);

Moreover, the script does not check for horizontal orientation of the legend. This is a little more involved to fix, but I have a quick and dirty fix if anyone wants it.

In my opinion, this function works even better if used with matlabfrag instead of laprint.

In order to use this with pentagrams, the following line needs to be added within the 'pentagram' and 'p' cases:
markers_edge{i} = '\large{$\bigstar$}';

Otherwise, the symbols fail to show up in the legend.

This solution works perfectly for me combined with laprint, but whenever I include legend2latex i lose the marker information stored within the legend.