Running executale file (gfortran) in Matlab on MacOS - matlab

Does any one know how to run an executable file (gfortran) from Matlab on Mac ?
Thank you in advance

See link: https://www.mathworks.com/help/matlab/ref/system.html
If you are trying to execute an already-compiled fortran code, try system('./script.o') or whatever your executable name is.

Related

trying to run runLTspice on matlab on mac but function was written for windows

I am trying to use David Dorran's code for running ltspice in matlab using the function runltspice. I have run into trouble as I am using a Mac and the code was written for Windows. The trouble arises when the code looks for scad3.exe which doesn't exist in the files included in the Mac version of ltspice. Is there a different file I can search for? Has anyone else had this problem?
Two options:
1) Figure out the correct command for ltspice on a mac (natively). I don't have a mac so I can't help with this.
2) Use macports to run the windows version on your mac.
sudo port install wine
wine LTspiceIV.exe
wine ~/.wine/drive_c/Program\ Files/LTC/LTspiceIV/scad3.exe
Then revise Dan's configuration script to look for & run scad3.exe in this new location and with wine.
Sources:
http://web.engr.oregonstate.edu/~traylor/ece391/install_ltspice
http://blog.bolkin.net/2013/07/running-ltspice-iv-on-osx.html

How to run text2image.cpp

I am working on tesseract. I want create new training language for tesseract. Please can anyone tell me what are the specific steps for training new language. And also tell me how to run text2image.cpp program. Thanks in advance.
To run text2image first compile and link text2image.cpp using an appropriate C++ toolchain then run the executable with the appropriate text file as an input. Alternatively you can download a windows installer which will give you an executable to use rather than the .cpp.
Instructions on building the tesseract tool chain are here and on how to train for currently unsupported languages is here.

Generate code Simulink/Stateflow

I generate C++ code using Simulink; Simulink builds file.exe but it doesn't run. The problem is:
the program can't start because libmx.dill is missing from your
computer. Try reinstalling the program to fix this problem.
By the way the file libmx.dll already exists in the Matlab path. How can I fix it?
If you try running the exe from within MATLAB using
>> system('my.exe');
does it work?
If yes, then the most likely cause is that the directory containing libmx.dll isn't on your system path.

Running Matlab MCR and MATLAB on the Same Machine

I'm having trouble getting a compiled .exe file to run with MCR instead of Matlab (I can tell because the program is using multiple threads, which it would not do if it were running with MCR). The MATLAB documentation (http://www.mathworks.com/help/toolbox/compiler/f12-999353.html) says:
"To run deployed components against the MCR install, mcr_root\ver\runtime\win32|win64 must appear on your system path before matlabroot\runtime\win32|win64.
If mcr_root\ver\runtime\arch appears first on the compiled application path, the application uses the files in the MCR install area.
If matlabroot\runtime\arch appears first on the compiled application path, the application uses the files in the MATLAB Compiler installation area."
Can anyone connect the dots a bit more for me? I don't know what this means. Thanks!
I had the same problem: my compiled code was multithreaded, which I did not want.
The problem got solved by compiling with the option:
-R -singleCompThread
You need to set properly the PATH global environment variable in Windows. How you do it exactly depends on Windows version.
Here is the first link from Google by query "set path on Windows": http://www.computerhope.com/issues/ch000549.htm
This variable is a list of directories. Make sure you have a directory with MCR executable earlier in this list than a directory with MATLAB executable.

Runtime error for MCC compiled program using parfor

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