iptPointerManager error when using roipoly (MATLAB) - matlab

I'm trying to use roipoly(I) to allow user selection of a region within an image. When I run the example code from MATLAB documentation:
img = imread('eight.tif')
imshow(img)
bw = roipoly(img)
I'm getting the following error:
Undefined function or variable 'iptPointerManager'.
with several other error lines after, but i'm quite convinced that the one above is the issue.
I have MATLAB R2016a on Windows 7 with image processing toolbox installed and working.

Resetting the path using restoredefaultpath worked.

Related

getpts MATLAB returns unrecognized function or variable 'getpts'

i'm trying to use getpts to choose points in the current figure using the mouse. However, when i run it, i'm getting the error "unrecognized function or variable 'getpts'."
Here's my code
for i=1:n
im = imread([read_path 'IMG_' num2str(i+t) '.jpg']); %Get image
figure
imshow(im)
[x,y] = getpts; %returns error
end
Any idea why that's happening?
Note: I'm using the free trial version of Matlab
I'd appreciate the help!
From the docs, getpts is in the image processing toolbox.
This isn't always obvious, you can infer it from the docs link itself:
mathworks.com/help/images/ref/getpts.html
(where a built-in would be something like mathworks.com/help/matlab/ref/sum.html)
You can also see it's nested under the image processing toolbox in the side-bar on that page.
In your trial installation of MATLAB you likely don't have this toolbox. You might know from the install process, or you could check whether the toolbox folder exists in the installation directory, e.g.

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.

MATLAB: Error in fig2texPS

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.

SSIM Coding Error

I have some questions. I try to follow some coding from Mathworks:
I = imread('cameraman.tif');
ssimValues = zeros(1,10);
qualityFactor = 10:10:100;
for i = 1:10
imwrite(I,'compressedImage.jpg','jpg','quality',qualityFactor(i));
ssimValues(i) = ssim(imread('compressedImage.jpg'),I);
end
I just change the image file which is a.jpg and b.jpg but I get this error from MATLAB:
Undefined function 'ssim' for input arguments of type 'uint8'
Error in SSIMTesting (line 6)
ssimValues(i) = ssim(imread('logohalal1.jpg'),i);
Why is that ? Can someone help me explain the code and the error ? Sorry because I'm new in MATLAB.
Thank you.
MATLAB release notes for the Image Processing Toolbox shows that this function was new to R2014a. If you have an older version of MATLAB, or you don't have that toolbox, you don't have it. This sort of issue can be avoided by using only examples found in the help on your local installation of MATLAB rather than the online help.
To check your version of MATLAB and installed toolboxes, type ver at the command line.
To check if a function can be found on your MATLAB path, you can use which, e.g. which ssim

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.