Matlab matlabpool function undefined - matlab

I am try to use the matlab parallel computing feature.
I first typed "ver" to check if I have already installed Parallel Computing Toolbox, it did
>> ver
----------------------------------------------------------------------------
MATLAB Version: 9.0.0.341360 (R2016a)
MATLAB License Number: 353265
Operating System: Microsoft Windows 10 Enterprise Version 10.0 (Build 10240)
Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-
Bit Server VM mixed mode
----------------------------------------------------------------------------
....
Parallel Computing Toolbox Version 6.8 (R2016a)
....
So it seems that I have already installed it. But when I try to use it, it just doesn't work
>> matlabpool('open',2);
Undefined function or variable 'matlabpool'.
>> matlabpool open
Undefined function or variable 'matlabpool'.

The command (as of R2013b) is parpool to create the pool of workers.
parpool(2)

Related

Solve function returning symbol

I am trying to use the MATLAB Symbolic Math Toolbox to solve simple equations, but I am not receiving the expected/desired result.
I'm using Windows 10, and this is the output of entering ver into the Command Window:
MATLAB Version: 9.6.0.1335978 (R2019a) Update 8
MATLAB License Number: STUDENT
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 19041)
Java Version: Java 1.8.0_181-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.6 (R2019a)
Simulink Version 9.3 (R2019a)
Control System Toolbox Version 10.6 (R2019a)
Curve Fitting Toolbox Version 3.5.9 (R2019a)
DSP System Toolbox Version 9.8 (R2019a)
Data Acquisition Toolbox Version 4.0 (R2019a)
Image Processing Toolbox Version 10.4 (R2019a)
Instrument Control Toolbox Version 4.0 (R2019a)
Optimization Toolbox Version 8.3 (R2019a)
Parallel Computing Toolbox Version 7.0 (R2019a)
Signal Processing Toolbox Version 8.2 (R2019a)
Simulink Control Design Version 5.3 (R2019a)
Statistics and Machine Learning Toolbox Version 11.5 (R2019a)
Symbolic Math Toolbox Version 8.3 (R2019a)
According to the in-app documentation, the solve function should follow this syntax:
syms x
eqn = sin(x) == 1;
solx = solve(eqn, x)
And the expected output from this is:
solx =
pi/2
However, when I run the same commands I receive:
>> syms x
>> eqn = sin(x) == 1;
>> solx = solve(eqn, x)
solx =
x
I have tried a number of even simpler equations with the same result (receiving symbol instead of a numerical value).
What am I doing incorrectly?
Thanks in advance.
As discussed in the comments, your MATLAB installation does not seem to use the function in ...\toolbox\symbolic\symbolic\solve.m when a solve command is issued; instead, an unrelated function provided by the maple toolbox is used, leading to some confusion. This issue can be solved by reordering the MATLAB search path:
p=path();
path(p,'C:\Program Files\MATLAB\R2019a\toolbox\maple');

cplex would not run on matlab due to invalid mex-file

I'm trying to use cplex on matlab but I'm getting the following error:
Error using cplexlp (line 256)
Invalid MEX-file 'C:\Program
Files\IBM\ILOG\CPLEX_Studio1271\cplex\matlab\x64_win64\cplexlink1271.mexw64': The specified
procedure could not be found.
Error in cplex_example (line 12)
[x,fval,exitflag,output] = cplexlp(f,A,b,Aeq,beq,lb,ub,options);
I have already added the paths as follows:
addpath ('C:\Program Files\IBM\ILOG\CPLEX_Studio1271\cplex\matlab\x64_win64')
addpath('C:\Program Files\IBM\ILOG\CPLEX_Studio1271\cplex\examples\src\matlab')
savepath
My laptop runs on Windows 10 64-bit, my matlab is R2013a 64-bit and cplex is cplex 12.7.1 win-x86-64.
I saw an answer to a similar question and they said it must be checked by dependency walker. Dependency walker showed that a whole bunch of API-MS-WIN-CORE, EVENTING, SECURITY, SERVICE, EXT-MS-WIN-GDI etc. dll files where missing.
I looked at a few posts implying that these are included in Visual C++ Redistributable packages, so I installed all editions of Microsoft Visual C++ Redistributable (both x86 and x64 just to be sure).
But I still have the problem. What am I missing here? Any help would be greatly appreciated.
MATLAB R2013a is not supported with CPLEX 12.7.1 (see the detailed system requirements). You'll either have to use a newer version of MATLAB or an older version of CPLEX.

Matlab builder JA: Problems with accessing builder JA

First of all I would like to thank you for any kind of help, I try to be as clear as possible.
If I want to use MATLAB builder JA via deploytool, I have there no option to create JAVA package in deploytool GUI. I suppose that I have something wrong with settings but don't know which step exactly.
So first of all I Install MATLAB 2013a with MATLAB builder JA Version 2.2.6, I had to install corresponding version of Matlab Compiler Runtime (version v8.1) and also windows SDK 7.1. It is necessary to have proper version of JDK corresponding to Matlab version, so when I use command in Matlab:
version -java
"Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode"
So I downloaded proper version of JDK (x64bit same like my OS and MATLAB version are).
Setup a JAVA_HOME path (C:\Program Files\Java\jdk1.6.0_17) in environment variable, and also add a custom path to "Path" variable in my case:
C:\Program Files\Java\jdk1.6.0_17\bin;
C:\Program Files\MATLAB\R2013a\runtime\win64;
C:\Program Files\MATLAB\MATLAB Compiler Runtime\v81\runtime\win64;
So then when I type in MATLAB getenv JAVA_HOME I get a right path to JAVA installation, but when I type again version -java I get same response like I had with no installation of JDK. When I try to write javac -version command in Matlab, I get this response:
"Undefined function 'javac' for input arguments of type 'char'."
I also type this commands in my command line in windows, and the result was good:
"java version "1.6.0_17'
Java(TM) SE Runtime Enviroment (build 1.6.0_17-b04)
Java HotSpot(TM) 64-Bit Server VM (build 14.3.-b01, mixed mode)"
In the ideal scenario i should get same response in matlab but I don't and I have absolutely no idea why.
I was reading lots of material about it and no one has the same problem. I tried matlab 2013b too with another licence, MCR, and JDK (1.7.0_11) but with same result.
What am I doing wrong? please help.. thank you very much

how to use vision.ShapeInserter in matlab?

when I compile the command line, it is error. I do not know what is wrong? any any help. Thanks!
Create the shape inserter object.
shapeInserter = vision.ShapeInserter;
#%Read the input image.
I = imread('cameraman.tif');
#%Define the rectangle dimensions as [x y width height].
rectangle = int32([10 10 30 30]);
#%Draw the rectangle and display the result.
J = step(shapeInserter, I, rectangle);
imshow(J);
Error:
Undefined variable "vision" or function "vision.ShapeInserter".
Error in ve_hcn (line 3)
shapeInserter = vision.ShapeInserter;
ver :
MATLAB Version: 8.0.0.783 (R2012b)
MATLAB License Number: 724504
Operating System: Microsoft Windows 7 Version 6.2 (Build 9200)
Java Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server >VM mixed mode
------------------------------------------------------------------------------------------------------- MATLAB Version 8.0
(R2012b) Communications System Toolbox Version
5.3 (R2012b) Control System Toolbox Version 9.4 (R2012b) DSP System Toolbox
Version 8.3 (R2012b) Image Processing Toolbox
Version 8.1 (R2012b) MATLAB Compiler
Version 4.18 (R2012b) MATLAB Report Generator
Version 3.13 (R2012b) Optimization Toolbox
Version 6.2.1 (R2012b) Parallel Computing Toolbox
Version 6.1 (R2012b) Partial Differential Equation Toolbox
Version 1.1 (R2012b) Signal Processing Toolbox
Version 6.18 (R2012b) Statistics Toolbox
Version 8.1 (R2012b) Symbolic Math Toolbox
Version 5.9 (R2012b)
vision.ShapeInserter is in the Computer Vision System Toolbox, which you don't seem to have installed. In the same toolbox (since release R2013a) there is also a function insertShape, which is easier to use.

which configuration option is used by Mex to compile using matlab?

say, if choose mexopts.sh as the configuration files for mex,
then how does mex decide which option listed in the mexopts.sh is used for compiling?
for example, using 32bit matlab on 64bit mac os x:
mexopts.sh looks like:
,,maci
........
,,maci64
......
Then, maci or maci64 is used when compiling?
What commands or way can I do in order to compile 32bit lib instead of 64bit lib?
Further explanation of my process and the error message I got :
I am using mac os x 10.8 (64bit) with matlab R2010a (32bit) to produce a binary mex-file.
The Xcode is 4.6 version, I installed Command Line Tools on my machine. Then I downloaded the patch from matlab for 2011 and 2012 version anyway. (if I don't install the patch, I got a lot of link errors saying some header files are missing).
After I installed the patch ( I believe it changes my mexopts.sh file), when I run mex a.cpp, I got error message saying that /Applications/MATLAB_R2010a.app/bin/maci64 cannot be found. Of course, it cannot find the maci64 folder, it is 32bit, there is only maci folder.
So Anyone knows what I should do in order to make matlab look for maci folder instead of maci64 folder? Thanks a lot!
MATLAB does not support cross compilation of MEX files. So your 32-bit MATLAB installation should be producing 32-bit MEX files even though the OS is 64-bit.
Also, from the article I've linked
Further, beginning with R2010b, a 32-bit version of MATLAB is no longer produced for the Mac.
If you're running R2010b or later, your MATLAB is not 32-bit anyway.
To see what switches the MEX script is invoking the compiler with, use the -v option.
You can also use the file tool to check whether the generated binary is 32 or 64-bit.
As its been explained, MATLAB produces MEX files of the same bit-ness as itself, not that of the OS. This is true at least on Windows with recent MATLAB versions, where you can have either 32-bit or 64-bit MATLAB running on 64-bit Windows. Other platforms are moving towards 64-bit versions only.
Here is another way to get the configured mex switches:
>> cc = mex.getCompilerConfigurations
>> cc.Details
In my case I get:
>> cc = mex.getCompilerConfigurations
cc =
CompilerConfiguration with properties:
Name: 'Microsoft Visual C++ 2010'
Manufacturer: 'Microsoft'
Language: 'C++'
Version: '10.0'
Location: 'C:\Program Files\Microsoft Visual Studio 10.0'
Details: [1x1 mex.CompilerConfigurationDetails]
LinkerName: 'Microsoft Visual C++ 2010'
LinkerVersion: '10.0'
>> cc.Details
ans =
CompilerConfigurationDetails with properties:
CompilerExecutable: 'cl'
CompilerFlags: [1x115 char]
OptimizationFlags: '/O2 /Oy- /DNDEBUG'
DebugFlags: '/Z7'
LinkerExecutable: 'link'
LinkerFlags: [1x327 char]
LinkerOptimizationFlags: ''
LinkerDebugFlags: '/debug /PDB:"%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb"'
To answer my own question, just for those who may be interested in it,
I checked the contents of mexopts.sh and modified the part for maci (specifically set ARCH=i386) , then compile. The error message is gone.