I am trying to use the function armaxfilter from the MFE toolbox, but I get an error:
>> parameters = armaxfilter(y,1,1,1);
??? Error: File: armaxfilter.m Line: 477 Column: 21
Expression or statement is incorrect--possibly unbalanced (, {, or [.
Apparently my code is correct, as can be seen from an example from help:
EXAMPLE:
To fit a standard ARMA(1,1), use
parameters = armaxfilter(y,1,1,1)
Any idea on what is wrong?
In any case, my aim is getting residuals from an ARMA model estimation on a time series, a suggestion on an alternative way would be helpful as well.
Looking at the code (from here) , the issue is probably with the tilde output. If you are using an old version of MATLAB which does not support ~, you may get the error you mention.
There is a simple way to check this. Try out at the command line:
[~,idx] = min(1:10)
If this causes an error, you are using a version of MATLAB which does not support ~. If you want to use that particular code, you will have to either upgrade your MATLAB, or edit all the files such that examples of the tilde are replaced with some sort of dummy variable, e.g.:
[garbage,idx] = min(1:10)
As the error message describes, the problem lies in the armaxfilter.m. You should open that file and see what code is written at the specified line. I am sure you will see a bug in there.
Related
In Matlab, which('filename', '-all') returns all the files with the given 'filename' in the Matlab path, but Octave only returns the first one (not the shadowed ones). Is there an easy way get the equivalent in Octave?
this is a longstanding feature request for Octave that as of this post has not yet been resolved. See Bug #32973 and Bug #32088. The latter link appears to have a workaround patch and function attached that never quite made it into the main codebase.
UPDATE 16 Nov 22: while the bug has not been fixed, rather than silently fail Octave v8 will now provide a warning to the user that the option is not yet implemented and only the first result will be returned.
What is the correct name for the situation where a Matlab-script calls a function, but provides arguments without parentheses?
Example:
clear xx
Alternatively, I could use parentheses and transfer a string with the variable name:
clear('xx')
How can I distinguish between both alternatives when googling for a solution?
Bonus Question: How can I put the content of a variable into a call that is NOT using parentheses? Specifically, a build-script using mcc with a dynamic -o filename option; calling mcc with parentheses would also be acceptable, but I don't know how to google that, hence this question.
Thank you!
When you call a function without the brackets, it is called command syntax. Here are three links to relevant documentation:
syntax
command vs function syntax
scripts and functions
Bonus answer
You cannot use a variable when using command syntax. From the docs:
When calling a function using command syntax, MATLAB passes the arguments as character vectors.
So it would work like so:
abc = zeros(10); % Some matrix called abc
mystring = 'abc' % A string containing the variable name
% Option 1:
clear('abc') % Clears the variable abc
% Option 2:
clear abc % As per above docs quote, interpreted as clear('abc')
% Option 3:
clear mystring % As per option 2, interpreted as clear('mystring') so doesn't work
% Option 4:
clear(mystring) % Interpreted as clear('abc') so works as expected
When calling mcc as you suggest in the question, the tooltip shows you can in fact use function syntax, despite the documentation being entirely shown using command syntax.
Notes
Using brackets is standard practise in MATLAB, since you also cannot get output values from a function when using command syntax.
Also from the 3rd docs link above, you can see a message discouraging the use of command syntax when using MATLAB.
Caution: While the unquoted command syntax is convenient, in some cases it can be used incorrectly without causing MATLAB to generate an error.
I'm trying to implement "Two bag-of-words classifiers", so I found resources at this website. http://people.csail.mit.edu/fergus/iccv2005/bagwords.html This website provides complete files including Matlab code. But I've encountered some errors while implementing the code.
I run this code on Matlab 2011b , under Windows 7.
At first, some errors occur because of path experession, but this can be soleved. At file "gg_lola_km_binary.m", replace "/" with "\" due to path expression in Windows, and it also needs to allocate appropiate path. After doing this, this error has been solved, but the next error occur:
Error using imformats>find_in_registry (line 512)
Format specifier must be a 1-D character array.
I consider whether this error results from Matlab version difference, but I don't know how to solve this problem.
Thank You
The error should be something to do with the format of your Input.Not your Matlab version. Most of the written distributed functions are constructed using basic operations and should work on most versions of Matlab (even the older versions); if not it will probably prompt an unknown function being called which it does not recognize.
Your errors seems to say that:
The function imformats>find_in_registry is looking for a 1 dimensional character array, which it did not find. (most possibly in your input file format or file path). I suggest you check again, without further information, we cannot help you.
I'm following an example from MathWorks.
When I run the code I get an erroneous output
Error in Untitled3 (line 38)
rmc = lteRMCDL(enb, ncw);
If the error you describe was preceded by:
Undefined function 'lteRMCDL' for input arguments of type 'struct'.
Then the most likely reason is that you do not have the LTE system toolbox, or that you have an older version which does not contain that function.
You can check which version of MATLAB you are running, and all the installed toolboxes you have along with their version number, by typing ver at the command line. Alternatively , you can check the location of a given function on the path by typing which lteRMCDL (this can help if the problem is that you have written a function with the same name as an existing MATLAB function, or if your MATLAB path is not set up correctly).
MATLAB online help shows by default the latest (2013b at time of writing) help and requires you to log in to show archived help files.
Does anyone know why one can't use the command
combnk(1:3,2)
in Matlab 2011a, or is there any way to make this built-in function working? The error message I got is
???Undefined function or method 'combnk' for input arguments of type 'double'.
The two most common reasons for Undefined function or method-errors are (1) typos, and (2) lack of the appropriate toolbox.
If you're sure you didn't make any spelling mistake, try ver on the command line to check which toolboxes you have installed. If the statistics toolbox is missing, there won't be combnk on the path.
additional tip by Colin T Bowers
If ver indicates you do have the statistics toolbox, then try which combnk. If this returns combnk not found, then you may need to refresh your path, with something like restoredefaultpath then savepath