MATLAB Undefined function error - matlab

I tried running the following image compression code on matlab. It was running properly with no errors up til yesterday. But today when I tried to run it, It gave me errors regarding undefined function imshow, wavedec2, etc.
ERRORS:
??? Undefined function or method 'wavedec2' for input arguments of type 'uint8'.
Error in ==> wave_project at 45
[c,s]=wavedec2(input_image,n,wname);
??? Undefined function or method 'imshow' for input arguments of type 'uint8'.
Error in ==> wave_project at 17
imshow(input_image);
I checked the various toolboxes I have by VER command and Image processing toolbox is in it!
This has happened with me before. But the program then, ran afterwards.
PROGRAM:
clear all;
close all;
input_imag7e1 = imread('101_1.tif');
input_image=imnoise(input_image1,'speckle',0.01);
figure;
imshow(input_image);
p=input('enter the number of vanishing moments of wavelett M ');
n=input('enter the decomposition level');
wname = strcat('db',int2str(p));
disp(wname);
[c,s]=wavedec2(input_image,n,wname);

I'm guessing that you are running a version of matlab that must check those toolboxes out from a central repository. If so, and there are currently too many people using that specific toolbox, then matlab does not assign you a license. We had this problem in the past. The only fix when it happened too often was to get the admin person to buy more licenses of that toolbox, or to run at an hour when others had released their license.
John

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.

Issues with MATLAB butter

I am using MATLAB R2015 and cannot implement 'butter' without getting an error related to too many output arguments from the polyfit part of the script. I have used the same implementation for years with other versions of MATLAB.
Example:
[b, a] = butter(2,[.15,.3]);
Error using poly
Too many output arguments.
Error in zp2ss (line 127)
den = real(poly(p(i:i+1)));
Error in butter (line 97)
[a,b,c,d] = zp2ss(z,p,k);
I get the same error implementing the examples in the help documentation.
Just a guess but is there any chance you've defined your own poly function? which('poly') should point to some Matlab directory unless you've defined it elsewhere, potentially as a variable?. For me on a newer version that path is something like $MATLAB/toolbox/matlab/polyfun/poly.m You can also edit the poly function edit poly and verify that there is one output argument for the function.
Also, I'd advise against ever writing decimal numbers without a leading zero. It took me way to long to figure out what [.15,.3] was. Instead write [0.15,0.3] or even just [0.15 0.3] Edit: I just realized that is an example in Matlab ... my point stands but the toolbox author should know better ...

Error in profiler for Matlab 2014a

I use osx mavericks with 2014a. To get a crisp screen I have updated the JRE and done the fix to the help-menu as described in the answer from 17 May here http://www.mathworks.com/matlabcentral/answers/102946-why-does-the-matlab-desktop-look-blurry-when-using-matlab-8-2-r2013b-on-my-mac-with-retina-display
This includes following the instructions from Mathworks http://www.mathworks.com/support/bugreports/870843
Maybe that is the reason for the error below but it is not certain as I had never tried the profiler on 2014a before I did the fix.
The Error:
When I try to click any function to get a detailed profiler report I get the following error:
Error using flip
Too many input arguments.
Error in flipud (line 14)
x = flip(x,1);
Error in profview>makefilepage (line 723)
sortedDataList = flipud(sortedDataList);
Error in profview (line 70)
s = makefilepage(profileInfo,idx, busyLineSortKeyStr2Num(busyLineSortKey));
Do you have your own function called flip on your MATLAB path? There is a new function shipping with MATLAB called flip which the profiler is trying to use.
http://www.mathworks.com/help/matlab/ref/flip.html
Try which -all flip - if you have a version on there, try removing it to see if that fixes things.

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.

bi2de error in MatLab

In MatLab, "> help bi2de" provides the following example:
B = [0 0 1 1; 1 0 1 0];
D = bi2de(B)
But when I try this on my own, I get the following error:
??? Undefined function or method 'bi2de' for input arguments of type 'double'.
Is there something wrong with this function in MatLab?
I am pretty sure that the reason why this problem happened is because of the license of the toolbox, Communications system toolbook, in which this function belongs in. Write which bi2de and see what will be the result. If it returns path of the function and the comment Has no license available, then the problem is related to the license. That means, license of the toolbox is not set correctly. Mostly it happens if the toolbox is added later, i.e., after installation of the original matlab. Please check and solve the license issue, then it will work fine.
bi2de is a function in the Communications toolbox. You need to have that toolbox to use it. If you do have that toolbox, then the problem is that your B matrix is being treated as double instead of binary (I don't have the toolbox so I can't test this).
Consider using bin2dec, which turns a string representation ('1011001', eg) into a decimal number. This function is not part of a toolbox; it's available as part of the basic MATLAB package.