How to properly install libsvm-3.11? - matlab

I'm using libvm-3.11. I downloaded it here and extracted. Then I set path in Matlab. After that whenever I run my program, it gives the same error always.
??? Invalid MEX-file 'E:\Gomu\Gomu General\final yr
Project\proj\libsvm-3.11\windows\svmtrain.mexw32': The specified module could not be found.
Error in ==> trysvm at 6
svmStruct = svmtrain(T,TrainMat,'showplot',true);
What should I do?

read the README file and compile the C files using mex. Mex files are platform/MATLAB version dependent. The binary download doesn't always work for everybody.

Related

Folder error setting up WSDL in Matlab on mac

I'm trying to set up WSDL tools in Matlab on a mac (following this tutorial: https://www.mathworks.com/help/matlab/matlab_external/display-a-world-map.html).
The matlab.wsdl.setWSDLToolPath('JDK',jdk,'CXF',cxf) function needs to get the path for both openJDK and Apache-CXF. I have downloaded both of these, but am unsure what the correct path should be on a mac. The examples provided on the MathWorks website and forums all have examples of paths for a PC, but on a mac it is not clear to me what the actual program file would be.
I get errors along the lines of these:
Warning: The path '/opt/homebrew/Caskroom/adoptopenjdk8/8,292:b10/OpenJDK8U-jdk_x64_mac_hotspot_8u292b10.pkg' has been
saved but the folder was not found.
> In matlab.wsdl.setWSDLToolPath (line 107)
Warning: The path '/Users/bricehen/Downloads/apache-cxf-3.4.6.tar.gz' has been saved but the folder was not found.
> In matlab.wsdl.setWSDLToolPath (line 107)
This is the error if I provide the path to the downloaded packages themselves.
If I provide paths to the unpacked folders I get from the downloaded pkg or tar.gz files, I get errors along the lines of:
Error using matlab.wsdl.setWSDLToolPath>checkVersion (line 232)
The path '/opt/homebrew/Caskroom/adoptopenjdk8/8,292:b10' does not seem to be a JDK folder.
Error in matlab.wsdl.setWSDLToolPath (line 119)
checkVersion(path, 'java', 'JDK', '-version', ...
Any help would be greatly appreciated!

SUN benchmark code Invalid .mex file error

I've downloadad the SUN benchmark code from MIT:
version 2:
http://people.csail.mit.edu/jxiao/SUN/source_code/
Once I download the 15 image dataset and run the function:
compute_features.m
I get an Invalid MEX file error:
Invalid MEX-file
'/home/arturo/Documents/Virality/reddit_data/SUN_source_code_v2/code/OpenCVmexWrapper/cvlib_mex.mexa64':
libcv.so.1: cannot open shared object file: No such file or directory
The file /home/arturo/Documents/Virality/reddit_data/SUN_source_code_v2/code/OpenCVmexWrapper/cvlib_mex.mexa64 actually does exist, so I'm thinking the problem hast to do with libcv.so.1, or the .mexa64 file is broken (which is very unlikely)
I read something about adding a path via LD_LIBRARY_PATH when I googled the error, but I'm not sure what path I should exactly add, at least temporarily. I have opencv installed along with its library, so I'm not sure what the problem is. My current system is Ubuntu 12.04 64bit.
There's a similar question here, but the answer says that for their specific case they have the source code of the MEX files posted, which is not the same fortune I have: running old mex file on new matlab releases
Found the answer. The key is to link explicitly to the folder the file 'libcv.so.1' is in just before running matlab.
so in the matlab folder:
LD_LIBRARY_PATH=/home/arturDocuments/Virality/reddit_data/SUN_source_code_v2/code/scene_sun ./matlab
And in matlab:
matlab>> compute_feature
Compling the source code in the other folders is also necessary.(vlfeat,VOC,libsvm). As well as editing the path in the function im2superpixels # GeometricContext_dhoiem from :
segcmd = '../segment_pedro/segment 0.8 100 100';
to:
segcmd = '/YOUR_PATH/SUN_source_code_v2/code/segment_pedro/segment/ 0.8 100 100';
*(The folder is one level above.)

Invalid MEX-file error in MATLAB using GPUstart

I get following error with run GPUstart in Matlab:
Error using ==> moduleinit at 14
Invalid MEX-file 'C:\GPUmat\modules\rand\RANDModuleManager.mexw64': The
specified module could not be found.
Error in ==> GPUmatLoadModules at 18
moduleinit;
Error in ==> GPUstart at 168
GPUmatLoadModules(fullfile(GPUmatPath,'modules'));
How to solve this?
I found a similar problem in google, maybe it will help you:
http://www.mathworks.de/support/solutions/en/data/1-X8A09/index.html
Subject:
Why do I receive a "specified module could not be found" error while
running a MEX-file created from MATLAB 7.0.1 (R14SP1)? Problem
Description:
When I try to run a MEX-file I created, I receive the following error:
??? Invalid MEX-file 'MEX-file name': The specified module could not
be found. where "MEX-file name" is the name of my MEX-file. However, I
did not receive any errors when compiling the file.
Solution:
This error can occur if you do not have all of the necessary DLL files
that the MEX-function is dependent upon or if you are running a
MEX-file on a different version of MATLAB than it was compiled on.
In order to view dependent DLL files and help locate the source of
this error, you may use the third-party product "Dependency Walker".
The Dependency Walker can be downloaded from the following web site:
http://www.dependencywalker.com/
Kindly refer to the attached solutioon below for more information on
how to use the Dependency Walker to profile your MEX file.
After finding the missing dependent module, add it to the directory
where the MEX file resides or add it to the system search path.

FORTRAN-MATLAB MEX file error

This is Subhash. I am having problem in linking fortran-matlab mex files.
I am running MATLAB R2010a. I am trying to mex fortran subroutines in MATLAB. I have installed MSYS, MinGW and gfortran. I have also downloaded and extracted gnumex in the c:\documents\MATLAB folder. I entered gnumex to run the installation settings.
At this point, I see a window pop-up and I entered the following:
MinGW's root directory ---> Pointed towards c:\mingw b) Cygwin's
root directory -----> left blank c)
Path to g95.exe ------> c:\mingw\bin
path to gfortran.exe ------> c:\program files\gfortran\bin e)
path to gnumex utilities ------> c:\users.....\matlab\gnumex
environment linking type ------> MinGW
generate mex dll or engine-----> mex
language for compilation -------> fortran 77
add stub ------> no
optimization level -----> -O3
path for libraries and .def files
c:\users...\Roaming\MathWorks\MATLAB\R2010a\gnumex
Mex options file to create:
c\users...\Roaming\MathWorks\MATLAB\R2010a\mexopts.bat
The above is my installation setup for mex with gnumex. When I hit make options file, an warning message pops out which says
" cannot corret mex.pl .....
"cannot open c:...\R2010a\bin\mex.pl for writing"
and when I hit ok, again it pops out saying to confirm overwrite of mexopts.bat .
I hit confirm and the opt file is created.
At this point I should have my mex setup ready. But, when I run the fortran mex examples xtimesy.f, etc.. ( I use mex filename.f at the command prompt) and I get the following error
g77: getValidInputLinkLibraries: No such file or directory
c:\prog~1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'xtimesy.mexw32' failed.
Error using ---> mex at 222
unable to complete successfully.
I tried this uninstalling several times, but ended up with the same error.
Could anyone please let me know where am I going wrong. Is this not the correct procedure to link the g77? Please throw some light on this.
I appreciate your time..
Thanks.
I recently tried to mex some fortran routines and failed due to the poor support for fortran compilers by matlab in windows. I got around the problem by using f2c to convert the fortran to C code, then creating a gateway routine in C which calls the automatically generated C code functions and mexing the resul using the visual studio 2008 compiler which integrates nicely with matlab (the free express edition version is sufficient, you will also be able to use it for debugging).
You can get f2c from http://www.netlib.org/f2c/. You must link the produced C code to the f2c library, which you may also have to build from the sources.
I know this all sounds very complicated, but it was easiest solution I found.

How to build levmar using MATLAB?

I am using Windows XP and matlab version is 7.10.0.
I have the levmar(Levenberg Marquardt) package from http://www.ics.forth.gr/~lourakis/levmar/levmar-2.5.tgz
In the README file, we are told to compile in matlab using mex using the following command:
mex -DHAVE_LAPACK -I.. -O -L -L levmar.c -llevmar -lclapack -lblas -lf2c.
I downloaded lapack.lib , blas.lib and f2c.lib for windows
UPDATE:
The original error got resolved after I built a vc project file given in the package.
But now there are some error messages like :
levmar.lib(misc.obj) : error LNK2019: unresolved external symbol _dgemm_ referenced in function _dlevmar_trans_mat_mat_mult
Did you create a file with a mex-function gateway? You can't just compile a c-function for Matlab; you need to do a little bit of work to take care of the I/O between Matlab and the c-code.
If you follow the steps outlined in this document, you should do fine.
You may have a look at immoptibox, which comprises Levenberg-Marquardt algorithm as well.
I just figured it out after searching a while and noticed that the levmar package included a vc project file which i needed to build and it created a file called levmar.lib .
But now I am getting some errors which involves messages like 'unable to resolve external symbols'