hgexport: undefined function handle

2 views (last 30 days)
Lian
Lian on 9 Sep 2018
Answered: Akshay Khadse on 14 Sep 2018
I'd like to save an existing figure to eps using hgexport. However it keeps telling me error: undefinded function handle. The problem might be due to the incompatibility between MatLab versions. I edited the figure in 2015a, but now exporting using 2018a (both mac version though).
Is there any quick solution, say manually adding a function handle (What is it? I know what a figure handle is) to it? It is a plot with subfigures and many lines in each subfigure.
Many thanks.

Answers (1)

Akshay Khadse
Akshay Khadse on 14 Sep 2018
I am assuming that you have a .fig file saved from MATLAB R2015a which you are trying to open and save to .eps using 'hgexport' in MATLAB R2018a. Can you post your code here to clarify this?
As per my knowledge, this is not a compatibility issue as I was able to successfully save the file as per the procedure I mentioned earlier.
Following is the snippet I used to generate a .fig file with subplots from R2015a:
myFig = figure;
subplot(2,1,1)
plot(sin(0:pi/50:2*pi));
subplot(2,1,2)
plot(cos(0:pi/50:2*pi));
savefig('myFig.fig')
Following is the snippet I used to convert the .fig file to .eps in R2018a:
myFig = openfig('myFig.fig');
hgexport(myFig,'myFig.eps')

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!