MATLAB: Error in fig2texPS - matlab

I want to use fig2texPS to export plots from MATLAB to LaTeX. I copied the the script to D:\Eigene Dokumente\MATLAB\fig2TexPS and added this folder as a path in MATLAB. Unfortunately, I receive the following error:
>> fig2texPS()
Undefined function 'find' for input arguments of type 'matlab.graphics.chart.primitive.Line'.
Error in fig2texPS (line 526)
lsh = double(find(handle(lshandles),'-class','graph2d.lineseries')); % find plots
PS: I use a version of the script which was updated in order to work with pdtlatex (http://pastebin.com/xK6KxxBT) that I found in the MATLAB Central File Exchange. The same error also occurs when I use the original script.

This might not be the answer you are looking for, but there is the marvelous matlab2tikz that does the job of conversion of figures quite nicely, which you could use as an alternative to fig2texPS.

I also use the function fig2texPS.m and it works very well. It might be an answer for your question to use an older version of Matlab. I am using 2013b and it works. While I have tried this function with Matlab 2015a, I was getting the same error message.
I hope my answer helps you with your problems.

Related

Invalid property 'PickableParts' using line in Matlab

I'm using the following script:
http://se.mathworks.com/matlabcentral/fileexchange/48576-circulargraph
to create an schemaball from a correlation matrix (my related earlier question can be found here). When I try to run the script (e.g. example.m file) I get the following error (click on the image to enlarge it):
I'm using Matlab R2014a. What do I need to do to get this working?
As #EBH already mentioned it seems I can't use this script on Matlab R2014a.

'webread' Matlab function not found

I am using Matlab R2010a but could not find 'webread' function but with the message : "Undefined function or variable 'webread'." is shown.
The only available web function is 'web'.
How to download that function or solve the problem anyway?
As you can see at the bottom of the documentation for webread function, it has been introduced only in matlab 2014b.
You might find this (aka this), or this helpful as a substitute. I do not know whether any of them will work well on such an old version of Matlab though.

Laguerre polynomials in MATLAB

I tried using the .. command in MATLAB to generate Laguerre polynomials but I keep getting this error every time:
I found this in the help section:
Since I have defined x as symbolic I shouldn't be getting this error.
Also on website I found this which says that the function does not run in MATLAB.
Can anyone help? Thanks in advance
Like you say, and the matlab help says this function only works inside mupad, maybe in later versions it works in matlab console.
If you want to use it, write mupad in Matlab Command window and then use it in the mupad, matlab will return you the result as I show in the picture
In R2014b+, there is a laguerreL function available directly from within Matlab. However, a version of this function was introduced to MuPAD in R2009a. You can call the MuPAD version from within Matlab
syms x;
feval(symengine,'laguerreL',2,x)
or
evalin(symengine,'laguerreL(2,x)')
Both return x^2/2 - 2*x + 1.
You can read more about interacting with MuPAD functionality from Matlab here. However, I'd recommend browsing and searching the archived documentation for your specific version or using your built-in HTML documentation (e.g., doc mupad or doc 'calling mupad').

Savefig not found

I am new to Matlab and trying to save my current figure to file. So, I have followed the official documentation at http://www.mathworks.co.uk/help/matlab/ref/savefig.html#inputarg_h and entered the following into Matlab:
figure;
surf(peaks);
savefig('PeaksFile.fig');
close(gcf);
However, I get the following error:
Undefined function 'savefig' for input arguments of type 'char'.
If I type in:
help savefig
I get the following error:
savefig not found.
Any ideas on what's going on? I would have thought that savefig comes with all releases of Matlab rather than requiring any add-ons. The version of my Matlab is 2013a.
It looks as though savefig is not implemented in Matlab version earlier than 2013b (from some experimentation and a comment at the end of http://www.mathworks.com/matlabcentral/fileexchange/10889-savefig). Instead, use saveas(h,'filename.ext'), which is documented here http://www.mathworks.co.uk/help/matlab/ref/saveas.html and is certainly included in 2012a.
You're using R2013a, while savefig was released in R2013b. I can't test if the functionality is identical as I don't have R2013b (or newer) on this computer, but you might try the savefig-function on the File Exchange, or other alternatives available in the R2013a-release.
The two answers are great. Another option which I believe has been around for many, many years is to use the print command:
print -f1 -djpeg bob.jpg
The -f1 is the figure number and obviously bob.jpg is the filename to which you want to write. I have code going back to 2007 using that but I am sure it goes back earlier than that. So it should work with pretty much any version you are using.
For that matter, using print, you can write PS, EPS, TIFF, PNG as well as JPG.

adftest function error in lagmatrix

Using the adftest function in MATLAB's econometrics toolbox, I'm receiving the following error:
>> [h1,pVal1] = adftest(y1,'model','ARD')
Error using lagmatrix (line 25)
lagmatrix: wrong # of input arguments
Error in adftest>runReg (line 705)
yLags = lagmatrix(y,0:(testLags+1));
Error in adftest (line 417)
testReg = runReg(i,y,testT,testLags,testModel,needRegOut);
y1 is a <41x1> vector of doubles.
Has anyone received this error or have any thoughts on what the issue is? I am using this code right out of the box so I'm not sure what is going on. I'd post to MATLAB's site, but it is down for maintenance.
This is either a bug in Matlab, in which case you should submit it on the Matlab support site. Before you do that, you should check that you don't have a function lagmatrix on your path that shadows the built-in function. Type
which lagmatrix
on the command line. If the path does not point to your Matlab installation, you should move lagmatrix off the Matlab search path.
Also note that y1 should not contain all NaN, or be otherwise degenerate, so you may want to check the function using the sample data as suggested in the help to be sure it's a bug and not just your data.
I had the same problem with this function. In my case, the problem was the function lagmatrix (older version) in my MATLAB path and the adftest function was the newest version. The soluction was delete the older version of lagmatrix.