KillaKem
KillaKem

Reputation: 1025

Export Matlab Figure to LaTeX

I am trying to use an open source Matlab figure exporter called fig2texPS but I can't seem to get it to work, the documentation says I have to get the figure number of the figure I want to export then call

fig2tex(myFigureNumber)

but I don't know how to get the so-called "figure number".Does anyone have some experience with this project or someone who can understand this documentation guide me on how to use it?

UPDATE: Tried plotting a function then getting the figure number from the figure window but it still does not work.Can you please clarify a bit more on how I would get the "figure handle"?

x = 1:1:10;
y = 1:1:10;
plot(x,y);
fig2tex(1); //Undefined function 'fig2tex' for input arguments of type 'double'.

Upvotes: 1

Views: 661

Answers (1)

chappjc
chappjc

Reputation: 30579

It's the figure handle, which you can get when you make the figure (myFigureNumber = figure;), or with gcf if the figure is active/current, or with other functions. However, most of the time you will see it right here:

enter image description here

EDIT: For your updated error message, the error is because MATLAB can't find fig2tex (should be fig2texPS). Find the path to fig2texPS.m and add it to your path with addpath C:\path\to\fig2texfolder where that file lives. Verify that it works with which fig2texPS.

Upvotes: 3

Related Questions