Two questions regarding Matlab's Engine (running Matlab from C programs)

Hi,
I have Two questions regarding Matlab's Engine:
1. I've seen examples where the engine is used to find eigenvalues using engeval("D=eig(A*A')"). Suppose I have a function in Matlab called ComputeEigenValue(A), how can I call it using engval?
2. Suppose I wrote C code that uses the Matlab engine as part of a solution in Visual Studio. Can I compile it as usual from Visual Studio, or do I need to compile it from Matlab?
Thank you,
Gil.

1 件のコメント

Gil
Gil 2013 年 3 月 7 日
So I'm trying to run a simple program following the tutorial:
I got to section 4.d, but I'm not sure what to do. What's currently written under Under Configuration Properties->Debugging->Command is $(TargetPath). Do I need to replace it with C:\Program Files\MATLAB\R2010b\bin\win32 or with PATH= C:\Program Files\MATLAB\R2010b\bin\win32?
I tried both ways and I when I try to run the program, I get an error "unable to start program 'C:\Program Files\MATLAB\R2010b\bin\win32 The system cannot find the file specified.
Can someone please write what exactly I need to write under "Command"?
Thank you,
Gil.

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2013 年 3 月 6 日

0 投票

engeval('Variable=ComputeEigenValue(A)');
I do not know about compilation.

7 件のコメント

Gil
Gil 2013 年 3 月 6 日
Thanks, that's a huge help !!!
Gil
James Tursa
James Tursa 2013 年 3 月 6 日
engEvalString(etc)
Gil
Gil 2013 年 3 月 7 日
Thanks, but I don't understand your response. What is etc?
Walter Roberson
Walter Roberson 2013 年 3 月 7 日
etc is the command you want executed.
Gil
Gil 2013 年 3 月 7 日
OK, thank you.
Gil
Gil 2013 年 3 月 7 日
I have another question regarding your answer - where should the function ComputEigenValue resise? how will the instance of Matlab will know about it?
Thank you,
Gil.
Gil
Gil 2013 年 3 月 7 日
Never mind. I solved it.

サインインしてコメントする。

その他の回答 (1 件)

Kaustubha Govind
Kaustubha Govind 2013 年 3 月 6 日

0 投票

See Compiling Engine Applications with IDE to compile your code in Visual Studio.

2 件のコメント

Gil
Gil 2013 年 3 月 7 日
Thank you!!
I have another question: I'm trying to run a simple program following the tutorial:
I got to section 4.d, but I'm not sure what to do. What's currently written under Under Configuration Properties->Debugging->Command is $(TargetPath). Do I need to replace it with C:\Program Files\MATLAB\R2010b\bin\win32 or with PATH= C:\Program Files\MATLAB\R2010b\bin\win32?
I tried both ways and I when I try to run the program, I get an error "unable to start program 'C:\Program Files\MATLAB\R2010b\bin\win32 The system cannot find the file specified.
Can someone please write what exactly I need to write under "Command"?
Thank you,
Gil.
Gil
Gil 2013 年 3 月 7 日
never mind. I solved it.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by