473,654 Members | 3,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c# & matlab

hi,

i'm searching for a way to connect matlab from c#.

im vb it is very easy:

Set MatLab = CreateObject("M atlab.Applicati on")
result = MatLab.execute( "a=5")
but im c# ????
Nov 15 '05 #1
3 9879
"Fabian Ruranski" <xp***@fcsnet.d e> wrote in message
news:#n******** ******@TK2MSFTN GP12.phx.gbl...
hi,

i'm searching for a way to connect matlab from c#.

im vb it is very easy:

Set MatLab = CreateObject("M atlab.Applicati on")
result = MatLab.execute( "a=5")
but im c# ????


A quick search in the help-files gives me
Object MyObject;
MyObject = Server.CreateOb ject("Acme.Comp onent.3");

Try searching for CreateObject and COM in the documentation for
more detailed information.

--
Erik Wikström
Nov 15 '05 #2
If it's available as a COM object or somesuch,
VS.Net should be able to build you a wrapper.
It's in Add Reference, one of the tabs at the top
is COM References, IIRC...

Have a nice day :)
Jim Bellinger

"Fabian Ruranski" <xp***@fcsnet.d e> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
hi,

i'm searching for a way to connect matlab from c#.

im vb it is very easy:

Set MatLab = CreateObject("M atlab.Applicati on")
result = MatLab.execute( "a=5")
but im c# ????

Nov 15 '05 #3
"James F. Bellinger" <Na************ *@do.not.spam.m e> wrote in message
news:ez******** ******@tk2msftn gp13.phx.gbl
If it's available as a COM object or somesuch,
VS.Net should be able to build you a wrapper.
It's in Add Reference, one of the tabs at the top
is COM References, IIRC...


I've tryed following :
I added reference to COM : "Matlab Application (Version 6.0) Type Library"
and then wrote this :

using MLApp;

..
..
..
private void Form1_Load(obje ct sender, System.EventArg s e)
{
MLAppClass ml = new MLAppClass();
ml.Execute("a=5 ");
}

First line opens Matlab Command Window.

Second line couses exception :

"An unhandled exception of type 'System.Invalid CastException' occurred in
mscorlib.dll
Additional information: QueryInterface for interface MLApp.DIMLApp failed."

That example in VB that Fabian posted works fine. This one doesn't.
Does anybody know why?
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1525
by: #TAN THIAM HUAT# | last post by:
can expert out there dealing in this kind of interface between MATLAB and Python? there is a link http://claymore.engineer.gvsu.edu/~steriana/Python/pymat.html which might be useful. any comments or ideas to share are welcome
4
2752
by: dataangel | last post by:
I'm a student who's considering doing a project for a Machine Learning class on pathing (bots learning to run through a maze). The language primarily used by the class has been Matlab. I would prefer to do the bulk of the project in python because I'm familiar with pygame (for the visuals) but I already have a lot of AI code written in Matlab. I'd like to be able to call Matlab code from within python. I'm not sure this is possible. My...
3
3998
by: Mohammed Smadi | last post by:
Hi; Does anyone know if we can call matlab for a python or bash script while feeding the matlab script some command line arguments? I have an interactive matlab script which i want to automate by feeding the args from a script. I know this is probably more suitable to a matlab group but any ideas will be appreciated.
6
22248
by: Lars Christiansen | last post by:
Hi! I am a master student in (geo)physics at the University of Copenhagen and part of a study group on C++ as a scientific programming language. I, and the other students in the group, have previously used MatLab in different courses to solve problems, and find it very easy to use. This has led us to the discussion: When should we use C++ instead of MatLab? When is C++ superior to MatLab - and when is it the other way
3
2378
by: DrOrbit | last post by:
I'm trying to configure Visual Studio 2005 (C#) to produce a MEX DLL that will interface with MatLab. I found an online source that describes some files that I need to attach to the DLL. The source says: "...Next, you'll be setting properties of the project (right click on the project name in the solution explorer and select "Properties") 2. Add <MATLAB>\extern\include to the include directory path
9
5287
by: Carl | last post by:
I am desperately looking for a way to call Python from Matlab. I have become used to Python's rich syntax and large number of libraries, and feel ridiculously clumsy being stuck with Matlab's rather restricted facilities for doing other things than standard mathematical work. Does anyone know of good techniques (or readily available software) for achieving a cross-language support between Python and Matlab? Carl
5
4850
by: robert | last post by:
Turning algs for old NumPy modules into numpy code I suffer from this: Upon further processing of returns of numpy calculations, lots of data in an apps object tree will become elementary numpy types. First there is some inefficiency in calculations. And then you get data inflation and questionable dependencies - e.g. with pickle,ZODB,mpi's ... : 0.0...
4
13743
by: itcecsa | last post by:
Hi, I am implementing a small Python project, what I am going to do is to open Matlab and run some M-files, and get some output from Matlab command prompt. I have no idea how to open Matlab from Python! Any suggestions would be appriciated!
14
3133
by: Luna Moon | last post by:
Dear all, Can C++/STL/Boost do the vectorized calculation as those in Matlab? For example, in the following code, what I really want to do is to send in a vector of u's. All other parameters such as t, l1, l2, l3, etc. are scalars... But u is a vector.
0
8379
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8294
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8494
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8596
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.