Code covered by the BSD License  

Highlights from
C# Matlab Program Launcher

5.0

5.0 | 1 rating Rate this file 20 Downloads (last 30 days) File Size: 836.37 KB File ID: #27654
image thumbnail

C# Matlab Program Launcher

by Amitabh Verma

 

18 May 2010 (Updated 06 Jun 2010)

Code to execute Matlab script or function without the requirement to launch Matlab manually.

| Watch this File

File Information
Description

C# Matlab Program Launcher v1.1

Amitabh Verma
amitabh@amitabhverma.com

This C# code provides a sleek loader that would execute your Matlab script or function without the requirement to launch Matlab manually. **This loader requires Matlab to be installed.**

The launcher is useful in cases where there is a Matlab GUI for visualization of data since it will hide the command window. Options exist to view the command window as well, however, the true purpose of this code is to provide a Windows executable feel.

Files included:

1. C# Matlab Program Launcher v1.0 (C# source code)
   Matlab Interface Library by Emanuele Ruffaldi (EngMATLib.cs included in program build from v1.1 instead of dll)
2. Example using the C# Launcher - Image Patch Tool (http://www.mathworks.com/matlabcentral/fileexchange/25111-imagepatchtool)
4. some_bat_file.bat // bat file to load any drivers (optional)

Howto:

1. Download (free version) C# from http://www.microsoft.com/express/Downloads/#2010-Visual-CS)
2. Open Matlab Envelope.csproj in C# and Build using Shift+F6
3. Copy ImagePatchTool.exe to the Example/ImagePatchTool folder
4. Run the Matlab script ImagePatchTool.m using the loader ImagePatchTool.exe without the need to run Matlab

To link your Matlab GUI the only modification required are:

1. Adding the following line to the _OpeningFcn in your m-file
ImagePatchTool = guihandles(); % Link for C# loader

2. Editing the name of the m-file in the C# code

MATLAB release MATLAB 7.10 (2010a)
Other requirements C# compiler - http://www.microsoft.com/express/Downloads/#2010-Visual-CS
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
19 May 2010 Alexander Patrushev  
04 Jun 2010 Amitabh Verma

Upgraded to 2010a. Everything worked fine after fixing the Path variable for a missing libeng.dll error.
Execute [matlabroot,'\bin\win32'] in Matlab(Win32) and paste the answer
to: My Computer>Properties>Advanced>Environment Variables>System Variables>Path after adding a semicolon at the end of the line.

06 Jun 2010 Paul Speth

Amitabh,
What is it that you executed in [matlabroo, '\bin\win32'] in Matlab(Win32)? After downloading the files for the C# Program Launcher I had an unsuccessful build (C#2010 Express, MATLAB r2010a) and I'm hopeful your own fix on the path variable will resolve my problems. Are you aware of any issues that running MATLAB in 64-bit would pose?
Looking forward to the success operation of your work! Thank you.
Paul

06 Jun 2010 Amitabh Verma

Paul,
       I am not exactly sure what difference lies with your 64bit system for compiling but had the following suggestion.

1. Download (free version) C#
2. Open EngMATLib in C# and Build
3. Copy EngMATLib.dll to the Example/ImagePatchTool folder also copy to Debug/Release folder under bin in C# Matlab Program Launcher (since EngMATLib.dll is referenced)
4. Open Matlab Envelope in C# and Build
5. Copy ImagePatchTool.exe to the Example/ImagePatchTool folder
6. Run the Matlab script ImagePatchTool.m using the loader ImagePatchTool.exe without the need to run Matlab

[matlabroot,'\bin\win32'] on my system will give the path of the matlab win32 dir which holds libeng.dll and needs to be updated in System Variables for 2010a. Also, the C# compiling is independent of Matlab so this should not be a problem in your case.

It would be helpful if you could post the error over here or send me via email.

Thanks.

Please login to add a comment or rating.
Updates
06 Jun 2010

Simpler compiling process. Corrected some references. Edited Howto for changes in version 1.1.

Tag Activity for this File
Tag Applied By Date/Time
c Amitabh Verma 18 May 2010 17:07:08
c sharp Amitabh Verma 18 May 2010 17:07:08
launcher Amitabh Verma 18 May 2010 17:07:08
loader Amitabh Verma 18 May 2010 17:07:08
application Amitabh Verma 18 May 2010 17:07:08
executable Amitabh Verma 18 May 2010 17:07:08
gui Amitabh Verma 27 May 2010 13:47:06
c sharp Jason Zhang 09 Mar 2011 00:02:18
gui Jason Zhang 09 Mar 2011 00:02:22

Contact us at files@mathworks.com