Solving an error in matlab code - matlab

I am having this error in Matlab (R2009a) and I try to find a solution for it with no success, this error shouldn´t exist since I am using a source code that I downloaded hence it should be working fine.
Any idea why is not working?
Error message:
??? Undefined function or method 'fittype' for input arguments of type
'char'.
Error in ==> ChIPnorm at 132 ft_ = fittype('smoothingspline');
Thank you!

Probably you didn't install the Curve Fitting Toolbox.
Or maybe the function was added after R2009a (I could not check the documentation for that version, but I can tell you on R2010a is available).

Related

Matlab RMI error in function contains at startup and during runtime

In the last couple days (since changing from Matlab 2017a pre-release to Matlab R2017a) I have been getting an error message when starting up Matlab, which states that the function or variable 'isTextStrict' is undefined:
Something similar occurs when actually calling the function contains, as for example in this small code snippet:
contains('test','test')
which throws the error
Undefined function or variable 'isTextStrict'.
Error in contains (line 37)
if ~isTextStrict(s)
And similarly:
Has anyone seen this problem before? This did not occur previously.
I would appreciate your help!
I had the same problem and reinstalling (after deleting both the problematic installation of R2017a and the pre-release version) solved the problem. I think I had left an open instance of the pre-release version when installing the R2017a, so that may be the problem.

Matlab corrplot function stopped working

The weirdest thing happened, it seems as Matlab corrplot function just stopped working. I have a piece of code which always worked perfectly fine. Now the same code is throwing an error. When I try
corrplot(CE,'varNames',{'Diam.','Depth','Rad.','Thick','Thin'})
I get:
Undefined function 'corrplot' for input arguments of type 'cell'.
The function is not deprecated, meaning that probably your Econometrics Toolbox is no longer available. You can check for the available toolboxes in your MATLAB license by running ver. Additionally you should run
which corrplot
C:\Program Files\MATLAB\MATLAB Production Server\R2015a\toolbox\econ\econ\corrplot.m
To show you whether it is around somewhere. I reckon something went wrong with the toolbox installation, so you should check whether you still have a valid license and, if so, reinstal the toolbox.
You might also have a variable called corrplot (which corrplot tells you whether that is the case) although in my case the error then is:
CE = [1:10].';
corrplot=1;
corrplot(CE,'varNames',{'Diam.','Depth','Rad.','Thick','Thin'})
Error using subsindex
Function 'subsindex' is not defined for values of class 'cell'.
which corrplot
corrplot is a variable. % Not good, you didn't want that.
Clear the variable with clear corrplot and check where in your code it creates this variable and rename it.

SPM12 debugging on Matlab

I have a problem using SPM on Matlab. I have an m-file that I need to debug and I have not written.
This code is old and probably the error is hopefully given by the difference in syntax of the newer versions.
The error pops out using this function spm_get_files, originally present in the code. When changing this function to spm_get (I found that these two functions are supposedly equivalent) I get the following error:
Error using spm_get (line 1726)
Illegal Action string
Error in suj6 (line 46)
Fr3 = spm_get('/home/***/folder','a3*093.img');
where '/home/***/folder','a3*093.img' is the directory of the input files I want to analyze. These are fMRI scans.
My Matlab version is 9(R2016a) and the SPM is SPM12. (The code is old and was originally written in SPM99)
Anyone can help me out?
Thank you!
spm_get_files is basically just this one line of code:
varargout = {spm_get('Files',varargin{:})};
Clearly if you would like to switch back to using spm_get, you need to explicitly add 'Files' as the first argument.

Cannot use some Matlab MPC Toolbox functions

I'm trying to use for example setoutdist Matlab function from the MPC Toolbox (I'm using Matlab R2013a on Windows 8.1). As a response I'm receiving:
Undefined function 'setoutdist' for input arguments of type 'ss'.
I am able to get help about this function using help setoutdist. When I'm typing the function name and left parenthesis I'm receiving prompt with list of the arguments. When I'm using which setoutdist -all I'm receiving proper output:
C:\Program Files\MATLAB\R2013a\toolbox\mpc\mpc\#mpc\setoutdist.m % mpc method code here
But the function doesn't work even in default Matlab path, so I don't think it is shadowed.
The same is with the other functions, for example setindist, setestim, mpc_struct, etc. but mpc, mpcstate and mpcmove functions works correctly.
I was trying: clear all, clear classess, rehash toolbox, rehash pathreset, rehash toolboxreset, restoring default paths using pathtool. I've blocked the antivirus and added exeptions to it's list. I've even reinstalled my Matlab, nothing helped.
Maybe this is significant: when I'm trying to edit the setoutdist.m I'm receiving message that access is denied.
I will extremly appreciate any help...
How are you calling setoutdist? The correct syntax is one of the three (see documentation - for R2014b):
setoutdist(MPCobj,'integrators')
setoutdist(MPCobj,'remove',channels)
setoutdist(MPCobj,'model',model)
where MPCobj is a Model Predictive Controller object, created for example with the mpc function. It looks like from the error message that you are calling the function with a state-space object, which is not allowed (I'm guessing).

Some problems about the mexLasso function

I am a student who is envolving in a research about robust visual tracking.
And these days ,I had met a problem in my study.
The teacher gave me a project of matlab code about the research, when I try to run this code, and the program error is as follows:
??? Attempt to execute SCRIPT mexLasso as a function:
F:\L1_Tracking_standard_car\mexLasso.m
Error in ==> L1Tracking_release at 95
c = mexLasso(Y(:,i), [A fixT], param);
Error in ==> demo at 46
tracking_res = L1Tracking_release( s_frames, sz_T, n_sample, init_pos,
res_path, fcdatapts);
When I go to the program tracking, I found that mexLasso function does not exist, Only get an empty mexLasso.m file and a mexLasso.mexw32 files.
My OS version is Windows 7 64bit,and the matlab is matlab 7.12.0 r2011a
Does anybody here knows the causes of my problem?
Anymore, I wonder if anybody knows who has the source code of the binary file mexLasso.mexw32.Because I thought that if I can get the source code of the file mexLasso.mexw32,then I could compile its 64 bit version myself.(I doubt that my os could not recognize the .mexw32 file.)
I hope my express clear enough to let you come to help me ,thanks a lot!
I think your analysis is basically correct - mexLasso is intended to be a MEX function, but MATLAB is finding only mexLasso.m which presumably contains help text. Unfortunately, the error you're getting isn't terribly helpful. As I see it, you have two options:
Obtain the source code for mexLasso and recompile on WIN64
Run the WIN32 version of MATLAB on your WIN64 machine
the function mexLasso comes from the SPAMS toolbox
http://www.di.ens.fr/willow/SPAMS/.
You can find the sources there and compile the mex file corresponding to your OS.
First, you need to find mexLasso.cpp file in http://spams-devel.gforge.inria.fr/downloads.html as Marial has already mentioned.
Then you can find and download the recent version of SPAMS.
A following stage is just to execute compile.m file on your MATLAB.
Finally you can find mexLasso.mexw64 in the build folder.
Good luck.