What arguments should be passed to (wekaCategoricalData)? - matlab

I am trying to use the Information Gain algorithm available in here, which is implemented in Matlab and it uses Weka java classes. However, I get the following problem when trying to run the code:
Undefined function 'wekaCategoricalData' for input arguments of type 'double'.
The code line which generates the error is this:
t.buildEvaluator(wekaCategoricalData(X, SY2MY(Y)));
SY2MY is just a transformation function and it is described here.
The algorithm apparently expects an argument of the type (spider data object), which I have no idea what it is exactly. There appears to be something wrong with the number of the arguments sent as well.
Any help is appreciated.

According the readme file included with the package, you need to run the load_fspackage.m script on initial installation of the "Feature Selection Package".
This will setup various M-file on the MATLAB path, as well as add the required Weka JAR-file to the Java classpath.

Related

How do I find selfor in Octave?

I need to implement unsupervised neural network using Octave. For that, I need to use "selforgmap" function. How do I find that function in octave or what are the packages include this function?
When I use "selforgmap", I got an error like this.
selforgmap
error: 'selforgmap' undefined near line 1 column 1
help selforgmap
error: help: 'selforgmap' not found
As of now there does not appear to be any implementation of selforgmap in octave or any of it's packages. The current neural net package, nnet, can be found at Octave Forge and the Function Reference link will show you everything currently included.
The link Andy commented with above to a current reworking if the nnet package also does not currently include selforgmap, but this could obviously change. The included function files can be seen inside the inst folder.
if MATLAB's selforgmap is not an option for you, you will either need to code your own implementation or switch bto another programming language. A quick search does reveal a Python implementation of selforgmap that may serve your purpose.

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).

running compiled matlab from matlab

I am trying to run compiled MATLAB code (by mcc) from inside MATLAB in a way that I can avoid using another license that is required by the compiled code. We need this because we run this same specific code part again and again and execution is stuck due to license waiting. We don't want to buy tons of this specific license just to mass run the same part. Is there any way to do this? tutorial?
Is it possible to compile a .m file to dll/so and wrap it like a mex and call it from MATLAB on the fly? How would I pass and retrieve complex arguments?
According to
http://www.mathworks.de/products/compiler/description3.html
creating shared libraries should well be possible.
Concerning passing and retrieving complex arguments:
If you plan to use mex, I'd assume you should be able to call the shared-library "main"-function with any arguments you'd like, using the mxArray type that you'll have to use anyway.
To run the MATLAB-compiled code in MATLAB, you want codegen, part of the MATLAB Coder. See this blog post on generating C code from MATLAB. The alternative, deploying code with mcc/mbuild and then reloading it into MATLAB with loadlibrary is rather contorted, and I wouldn't advice it.

Using a dll file in matlab code

I need to use a function in Matlab that is defined by a dll file. I got an example that guy converted a dll to mexw32 file but i have known how I do this. I tried use loadlibrary but it didn't create any file.
How I can do this?
loadlibrary is MATLAB's implementation of FFI services, a mechanism of calling functions in external shared libraries. It involves converting between C-types and their equivalent MATLAB data types to pass data around.
MEX-files are also a kind of dynamically linked libraries (with .mex* extension), that can be run directly in MATLAB as a regular function without any special syntax.
The difference is that it has a specific gateway routine called mexFunction, which receives both input and output as mxArray type. mxArray is an opaque type defined in mex.h header file, which is the fundamental type underlying all MATLAB data. You usually manipulate this data using functions in the MEX library API.