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.
Related
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 was trying to add a toolbox in MATLAB and instead of calling addpath('path'), I called path('path').
Now I'm getting a lot of errors, like
if I initialize a variable, I get
Error using eval. Undefined function 'workspacefunc' for input arguments of type struct
Is there anyway I can restore the default MATLAB path/paths ?
Use the MATLAB command
restoredefaultpath
to restore the MATLAB search path to the state at startup.
See MATLAB documentation for restoredefaultpath here
I had a similar situation where on startup, on Windows 8.1 64-bit, Matlab R2014b would show the same error and then no function would work.
In my case, restoredefaultpathcouldn't be found.
Setting the UserPath in the matlab setting file as suggested elsewhere also didn't help.
The solution was to remove the environment variable MATLABPATH that I had set as a convenience while trying to compile against Matlab libraries.
The error message could be more helpful...
I have build a program that run properly in m file MATLAB. but when I compile to exe using Matlab compiler, some function didn't work. here is the error command window show on matlab execute program
undefined function or method 'maple' for input arguments of type 'char'
error in ==> function_a at 5
codes on function_a.m is
function function_a(msg)
format long
%parameter p & q
maple('z1:=',randint(1,1,[12 20])); %these run in m.file, but not in exe compile
p=maple('nextprime(z1)');
p=str2double(p);
is there any solution for that?please need your advice, many thanks
Assuming you have tried to compile the version from exactly this sourcecode and that you call it twice with exactly the same input, it appears that MATLAB simply does not realize that the function maple will be used by you.
I have had this before with some project, eventually I decided to use the 'add additional resource to project' option in deploytool.
Depending on your needs you can either just add the function, or the folder containing this function.
The command maple is from Symbolic Toolbox, which is not supported by MATLAB Compiler. You will not be able to successfully compile and run your program.
What's happened is that the maple command is not allowed to be compiled, so when the .exe runs, it can't find the function maple, and gives you the error you're seeing. It would be nice if MATLAB gave you a more informative error message, but it seems it doesn't.
As the title says, I want to have a parfor loop with inside usage of arrayfun.
I created a minimal working example for the problem:
Having the following lines in a file called thisparfortest.m
function test=thisparfortest(countmax)
parfor count=1:countmax
test(count).nummer=count;
test(count).bisdrei=arrayfun(#(testnum)eq(test(count).nummer,testnum),1:3);
end
the command mcc('-e','-v','thisparfortest') results in
Compiler version: 4.18.1 (R2013a)
Error: File: **************\thisparfortest.m Line: 3 Column: 5
The variable test in a parfor cannot be classified.
See Parallel for Loops in MATLAB, "Overview".
Processing C:\Program Files\MATLAB\R2013a\toolbox\matlab\mcc.enc
Processing include files...
2 item(s) added.
Processing directories installed with MCR...
The file mccExcludedFiles.log contains a list of functions excluded from the CTF archive.
0 item(s) added.
Generating MATLAB path for the compiled application...
Created 43 path items.
Parsing file "****************\thisparfortest.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB\R2013a\toolbox\compiler\deploy\deployprint.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB\R2013a\toolbox\compiler\deploy\printdlg.m"
(Referenced from: "Compiler Command Line").
Unable to determine function name or input/output argument count for function
in MATLAB file "thisparfortest".
Please use MLINT to determine if this file contains errors.
Error using mcc
Error executing mcc, return status = 1 (0x1).
but as advised mlint thisparfortest (and also checkcode) returns no problems - like in the editor.
The loop can be done and compiled as a for loop.
Please do not ask for the sense of these commands - they are just here for the mwe.
I think, this should be reported to mathworks - or have I done something wrong?
Some additions:
When running
function retval=thisparfortest(countmax)
helpfun=#(x)arrayfun(#(testnum)eq(x,testnum),1:3);
parfor count=1:countmax
retval(count).nummer=count^2;
retval(count).bisdrei=helpfun(retval(count).nummer);
end
with only the for loop it works, but when using the shown version with parfor it results in
Error using thisparfortest>(parfor supply) (line 3)
Undefined function or variable "retval".
Error in thisparfortest (line 3)
parfor count=1:countmax
Caused by:
Undefined function or variable "retval"
Shouldn't that be caught by mlint/checkcode? This happens without compiler.
I don't believe the issue has anything to with compilation. When I attempt to run your code in regular MATLAB I get the same error that the variable test in a parfor cannot be classified.
There's no bug here - not every piece of code can be run inside a parfor loop, and it's not possible for MATLAB to perfectly determine prior to runtime which pieces can and can't. It tries to do a good job, and when it does, the Code Analyzer will tell you prior to runtime - but when it can't, it will give a runtime error as you've found.
Perhaps you can think of a way that MATLAB could have statically determined that this variable could not be classified - in that case this could be reported to MathWorks as an enhancement request to Code Analyzer.
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