I've recently installed mexopencv for MATLAB on my Windows 7 machine. I'm using MATLAB 2015a 32-bit (on a 64-bit machine). I followed the recommended installation steps (from a number of sources - I had compiler issues to start with) and eventually got it working. The final step in the process is running the following command in MATLAB:
mexopencv.make
This is fine and I've been using it happily ever since. However, whenever I restart MATLAB and run my code which uses mexopencv functions, I get the following:
Error using cv.undistort
Invalid MEX-file 'C:\mexopencv-master\+cv\undistort.mexw32':
C:\mexopencv-master\+cv\undistort.mexw32 is not a valid Win32
application.
After some investigation it seems the only way I can get around this is to run the following every time I restart MATLAB:
mexopencv.make('clean',true)
mexopencv.make
So this is essentially re-compiling the mex files every time I start MATLAB. This takes a good couple of minutes and is a real pain!
Is there some way to get around having to do this each time?
I was facing the same problem (needed to rebuild mexopencv every time). Some people said they solved this problem by setting system PATH but not in my case. Mine was solved by copying all opencv dlls to the same directory those compiled mex files are.
Related
I do research in oil simulation, I normally use a simulator called Eclipse from a company called Schlumberger and I was able to use it from my scripts from Matlab using the following command.
% file name 'ICFM.DATA';
system(['eclrun',' eclipse ', C:Path\ICFM.DATA]); % Command to run ECLIPSE
Now I had installed a new Free simulator (OPM.org) in linux and I am using Octave for programming. but I am unable to find out how to run simulator from Octave.
The simulator can be run simply by writing
flow ICFM.DATA
and the results using a command
ecl_summary ICFM.DATA
I want to be able to run and get the results from with in Octave but I have not being able as in Matlab.
Any suggestions? someone?
Assuming both the flow and ecl_summary commands are on your system path (i.e. the "linux" path, not in octave), then it should simply be a matter of:
system('flow /my/path/to/ICFM.DATA');
system('ecl_summary /my/path/to/ICFM.DATA');
(where you should change /my/path/to with whatever path your data file is in).
I found that I am able to run the simulation using the syntaxes
unix('flow ICFM.DATA')
This is in Matlab R2017b for Ubuntu 16.04
Initially I got an error as the output was reporting:
....'GLIBCXX_3.4.21' not found
All the problem was due to a Matlab issue that was solved using the answer on
https://askubuntu.com/questions/719028/version-glibcxx-3-4-21-not-found
which was to type:
LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libstdc++.so.6" matlab
on the terminal.
After setting up the program ,I meet a fatal error on Startup matlab .As following :
Failed to start the Java Virtual machine - JNI error: -3
I want to know where is error and how to solve it .Please help me ,Thanks !
PS: My OS is windows 7 (32bit) ,and jdk 1.8(32bit) is set up successfully (Certainly PATH and CLASSPATH is set OK).
When you launch the application, does that error display in a dialog box, or within the MATLAB console? Does MATLAB launch if you use the '-nojvm' flag (in your shortcut path or from within a Command Prompt window)? If not, does it launch if you use a '-nodisplay' flag?
Definitely make sure you don't have a 'matlab_java' environment variable set, and if you are able to launch MATLAB, you should run the following commands:
>> rehash toolboxcache;
>> restoredefaultpath;
>> savepath;
After running the commands, restart MATLAB. When MATLAB launches, do you still see the error?
If you aren't able to get MATLAB to run, can you look within your %temp% directory for an error log? I don't recall the specific naming convention, but you should be able to find it based on it's timestamp.
Hope this helps, and if it doesn't, try calling the MathWorks Installation and Licensing team. As long as you have a real license, they'll help you.
Disclaimer: I'm a former member of the recommended team above, but have no current affiliation with MathWorks.
I encountered a very strange problem when using the SYSTEM function to call an executable file from Matlab.
First, I can run the executable file in a window console with no problem. However, when I call system(foo.exe) in Matlab, it does nothing but return the status value -1.0737e+09, and it does not throw any warnings or errors.
I am using Matlab R2009b on a 32-bit windows system and the executable file depends on OpenCV2.40.
The system path variable definitely include all the required lib directories. I also tried adding the relevant paths in the LD_LIBRARY_PATH, and copying the dlls in the working directory. These attempts do not change anything.
I also tried calling SYSTEM('cmd') from Matlab, and running the executable in the invoked window console. It gave me no response, either. It seems like the running environment of the console called from Matlab is different from the original window console.
Running the same code on a different machine in Matlab is successful.
I had this exact same problem. It turned out I simply needed to restart Matlab. I had not restarted Matlab after installing OpenCV2.1.
I have problems running a program compiled with MCC that uses parfor. The non-compiled .m version works (no bug). When I run the compiled version, I get
"distcomp.remoteparfor" is undefined. I believe I exactly have the error described in
the following link.
http://www.mathworks.com/support/solutions/en/data/1-PAHWE/index.html?product=CO&solution=1-PAHWE
However, since MCR is not installed on my machine (got Matlab and MCC),
I am wondering what the pathes $APPNAME_mcr/java/jar/toolbox and
$MCR/MATLAB Component Runtime/v70/java/jar/toolbox correspond to. I found
the distcomp.jar file in C:\Program Files\MATLAB\R2011b\java\jar\toolbox, but I don't know where to put it since see any path corresponding to $MCR/MATLAB Component Runtime/v70/java/jar/toolbox since MCR is not installed.
Thanks a lot!
Fred
No need to install the MCR if you are simply trying to run the application on the same machine that has MATLAB. The question to ask is, HOW are you launching the compiled application? From a DOS command window? From within MATLAB using the SYSTEM command?
If you are launching the application from a DOS / UNIX command line, then the important thing to keep in mind is that the MATLAB binaries need to be on your system path i.e. just make sure:
$MATLABROOT\bin\$ARCH
is on your system path. Where $MATLABROOT is the matlab installation folder, and $ARCH is your system architecture. For example:
c:\work\matlab\bin\win64
on my machine since my installation folder which contains MATLAB is:
c:\work
and i am on a win64 machine.
The problem is solved. The solution is to make the program
a function instead of a script :
http://www.mathworks.com/matlabcentral/answers/22825-parfor-errors-when-file-is-compiled
I seem to have wiped out my path environment variable a while back. I've been slowly restoring things. I have both MATLAB and the MATLAB compiler installed. DLL's I've created from the MATLAB compiler won't run because they can't find the MATLAB compiler runtime dlls. While I did find the particular files that are my immediate problem. I'm wondering if there is a MATLAB *.bat file or command I can type that will restore my path variable to what it was after MATLAB and the Compiler were installed. I'm hoping to forestall future problems.
In case it's version specific I'm running MATLAB R2010b, I'm running a 32 bit version on a 64 bit machine.
[Edit]
I thought I would add that the path I need for running the compiled version was:
C:\Program Files (x86)\MATLAB\MATLAB Compiler Runtime\v714\runtime\win32
With luck, that one along with the two suggested in the answer will get me back to the original state.
restoredefaultpath might recover your MATLAB installation. Consider the use of startup.m, in order to easily undo changes to your environment.
You want to have these two directories on the PATH (I think the order is important):
C:\Program Files\MATLAB\R2010b\runtime\win32
C:\Program Files\MATLAB\R2010b\bin
Obviously you need to adjust the path to match your setup and architecture (those are on a WinXP 32-bit)
If you have a current software maintenance contract for your MATLAB, it may well be that the easy thing to do is just upgrade to the next version of MATLAB since R2011a is out now (unless there is some compelling reason why you must develop on R2010b. Running the software installer should recreate the default environment for MATLAB. I am, of course, assuming that you have Administrator access on your PC and have permission to install software.