|
|
Comments and Discussions
|
|
 |

|
i have done some coding in vb10 for ECG and i want that ECG database in matlab.
ho wto do it ?
|
|
|
|

|
HI, It was realy helpful for me. thank you
|
|
|
|

|
Hi!
PROBLEM 1:
I have a problem with the last example you give using DllImport. For some reason I can't figure out how to use basic numeric types such as double, int32 etc.
My MATLAB-file (*.m) is as follows:
function y = test(x)
z = cast(x, 'int32');
y = z+z;
end
After creating the DLL and imported the required mlftest()-function I created a function that calls it:
public static Int32 mlfTestCsharp(Int32 x)
{
Int32 res = mlfTest(x);
return res;
}
When I call it in main() like this:
static void Main(string[] args)
{
Int32 x = 2;
Console.WriteLine("Matlab testlib: " + mlfTestCsharp(x));
}
I get an AccessViolationException telling me that I tried to access protected memory for reading or writing (the same message @kumar dhruva got). Can you please provide some feedback on this matter if it's not a problem for you?
PROBLEM 2:
In your last section "Examples and Usage" you use type Matrix. My question is - where is this Matrix-type defined?
Thank you very much for your time in advance!
RBA
|
|
|
|

|
Thanks
|
|
|
|

|
This is a very useful library...is there a way to use it with Octave?
Thanks...
|
|
|
|

|
Thank you very much for this article, it is very informative.
There is just one thing.. you say that .m files can be translated into DLLs and I think this is only possible if you have the MATLAB Compiler installed.. If that is so, you might want to mention it in the appropriate paragraph above. If not, please describe how to do it..
Thanks again for the code and this great article!
modified 15 Jun '12 - 14:35.
|
|
|
|
|

|
I am using MATLAB 7.12.0 (R2011a). Downloaded the demo code binary and tried it. Nothing worked. Guess this library doesn't work with my version of MATLAB.
|
|
|
|

|
Although you did not describe your problem.. which does help .. I assume you ran into the same thing I had..
I got a PInvokeStackImbalance exception when a function was called. Explicitly stating the calling convention solves this problem.
For example:
[DllImport("libeng.dll")]
public static extern IntPtr engOpen(string startcmd);
has to become:
[DllImport("libeng.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr engOpen(string startcmd);
Best wishes!
|
|
|
|

|
Hello all! I have problem:
I have a function createnet on matlab as:
function net =createnet()
a = magic(81);
input = a(1:81, 1:10);
b = magic(10);
target = b(1, 1:10);
network = newff(input, target, 20);
net = network;
return;
and then I build it to dotnet library and use it in csharp code but it have exception about "set adaptFcn" in subsasgn.m file in .//..//temp//../@network//subsasgn.m
Can eveybody help me! thanks all!!
This is exception message:
"System.Exception was unhandled
Message=
... MWMCR::EvaluateFunction error ...
Output argument "err" (and maybe others) not assigned during call to "C:\Users\hotoan\AppData\Local\Temp\hotoan\mcrCache7.9\CoreMT5\toolbox\nnet\nnet\@network\subsasgn.m>setAdaptFcn".Error in =>CreateMTANN.m at 34.
... Matlab M-code Stack Trace ...
at
file C:\Users\hotoan\AppData\Local\Temp\hotoan\mcrCache7.9\CoreMT5\toolbox\nnet\nnet\@network\subsasgn.m,name subsasgn,line at 435.
at
file C:\Users\hotoan\AppData\Local\Temp\hotoan\mcrCache7.9\CoreMT5\toolbox\nnet\nnet\nnnetwork\newff.m,name new_5p1,line at 171.
at
file C:\Users\hotoan\AppData\Local\Temp\hotoan\mcrCache7.9\CoreMT5\toolbox\nnet\nnet\nnnetwork\newff.m,name newff,line at 89.
at
file C:\Users\hotoan\AppData\Local\Temp\hotoan\mcrCache7.9\CoreMT5\CodeMTANN\CreateMTANN.m,name CreateMTANN,line at 34.
Source=MWArray
StackTrace:
at MathWorks.MATLAB.NET.Utility.MWMCR.EvaluateFunction(String functionName, Int32 numArgsOut, Int32 numArgsIn, MWArray[] argsIn)
at MathWorks.MATLAB.NET.Utility.MWMCR.EvaluateFunction(String functionName, MWArray[] argsIn)
at CoreMTANN.CoreMTANN.CreateMTANN(MWArray input, MWArray target, MWArray numHiddenNeural, MWArray goal, MWArray epochs, MWArray trainingRate)
at Presentation.fMain.CreateMTANN() in C:\Users\hotoan\Documents\Visual Studio 2010\Projects\MTANN\Presentation\fMain.cs:line 130
at Presentation.fMain.btnCreateMTANN_Click(Object sender, EventArgs e) in C:\Users\hotoan\Documents\Visual Studio 2010\Projects\MTANN\Presentation\fMain.cs:line 238
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Presentation.Program.Main() in C:\Users\hotoan\Documents\Visual Studio 2010\Projects\MTANN\Presentation\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
"
|
|
|
|

|
I just used your code... it's works fine! Tnx
|
|
|
|
|

|
Hi,
I am new to this forum,
and new to c# & MATLAB,
I am trying to run a c# program which is calling a matlab dll.
I am creating a mxMatrix from my local array and passing it to matlab, while I am trying to access the mxMatrix which is returned by matlab dll, i am getting the error "access violation, Attempted to read or write protected memory. This is often an indication that other memory is corrupt".
can someone suggest some solution.
Thanks
Dhruva
|
|
|
|

|
hello
I need to provide facility for Matlab to do bulk insert to SQL. Matlab provides ways to load .NET assembly and call .NET methods:
Assembly reference: http://www.mathworks.com/access/helpdesk/help/techdoc/ref/net.addassembly.html
Method calls: http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/brpb58s-1.html#brpca5n-1
However, we can't pass "Cell Array":
Example:
% 2 Dimensional array of numbers
a=[1 2 3; 3 4 5; 6 7 8]
aa=[1.1 2.2 3.3; 4.4 5.5 6.6; 7.7 8.8 9.9]
% Single dimension string array (2D not permitted)
b={'aaa0'; 'bbb0'; 'ccc0'}
bb={'aaa0','aaa1'; 'bbb0', 'bbb1'; 'ccc0', 'ccc1'}
c={'20100701' 1.11 2.22; '20100702' 3.33 4.44; '20100703' 5.55 6.66;}
"c" above is cellarray
Now, my only option is to wrap bulk insert logic in ATL COM server, and call from Matlab as such:
dbServer = actxserver('MyDBComServer');
The first article below shows how to build a simple ATL server in C++ but:
PROBLEM 1: sample shows only passing simple type such as string/BSTR - I need to pass a Matlab CellArray across (For this problem... I don't have much clue how CellArray is represented in memory as thereby passed across Matlab/COM/.NET borders)
PROBLEM 2: I don't have access to .NET System.Data.SqlClient.SqlBulkCopy (For this problem can I packaged ATL done by C#? From Visual Studio 2008 \ New Project, I can find "ATL Projects" only under VC++. Is my option a COM server without ATL as indicated in Third Reference below? I am inheriting an old VB.NET COM project but having problem getting it registered, but it must be possible)
PROBLEM 3: Windows 2003 64 bit - any deadend you know?
http://digital-clipart.de/KB/COM/SimpleCOM.aspx
1..2..3 ways of integrating MATLAB with the .NET[^][^]
http://msdn.microsoft.com/en-us/library/aa645712(v=VS.71).aspx[^]
dev
|
|
|
|

|
hey guys!!!
d frontend of ma project is in VB.net and d processing part is done by matlab...
i want to understand d connectivity between matlab and dotnet...
1.d user would first load an image in d VB.net form.... (which i hav implemented)
i need to implement d follow...
2.d image would be den passed to matlab for processing....
3.after processing matlab will return d output in form of image....
wat shall i do inorder to link matlab n dotnet???? plz guys help me.....thanx in advance....tc....
|
|
|
|

|
I spent a while trying to get this to work but noted that the post was originally published in 2003. There is a .Net builder in Matlab, which can be accessed using the command 'deploytool' inside the Matlab IDE. This builds DLLs as well as .Net objects (which can of course be included in your C sharp project). I haven't tried it out properly yet, but hopefully will work ok.
|
|
|
|

|
I agree - this article is a little out-dated - check the matlab doc for matlab builder NE which is the deployment tool for converting M files to .Net FWK DLLs
|
|
|
|

|
hello
Matlab support request - basically, I'm able to call COM (in-process server) component developed in C# from Matlab - this C# function for example:
(Example http://www.codeproject.com/KB/vb-interop/csCom.aspx)
public int PerformAddition(int a, int b)
{
// throw new Exception("The method or operation is not implemented.");
try
{
return a + b;
}
catch
{
return 0;
}
}
Now my trouble is, I want to:
(a) pass in array of args of mixed types (int, doubles, string, DateTime ... etc, no custom Struct/Classes)
params object[] args
(b) return a 2 dimensional matrix of mixed types (if not possible perhaps thru C# "ref" input variable)
For example,
public int RunStoredProc(string strProcName, ref object[,] oResult, params object[] args)
{
object[,] oResultMatrix = { { "USDHKD", 7.81, 7.82, 7.83, 7.84, 7.85}, {"USDCAD", 1.08, 1.09, 1.10, 1.11, 1.12} };
oResult = oResultMatrix;
return 1;
}
Matlab code would resemble:
h = actxserver('SQLCmdRunnerClass')
strStrategy = 'longOnlyDirectional';
strRegion = 'NA';
nExchgCode = 123;
ResultMatrix = zeros(10,10); << Problem #1 (Predefine ResultMatrix): Also how can I not pre-define Matrix dimension
h.invoke('RunStoredProc', 'sp_GetPortfolio, ResultMatrix, strStrategy, strRegion, nExchgCode); << Problem #2
release(h);
Problem #1: If I don't predefine ResultMatrix, The error message (when call invoke) is:
??? Undefined function or variable 'ResultMatrix'.
Problem #2: Now if do predefine ResultMatrix, the error message (when call invoke) is:
??? No method 'RunStoredProc' with matching signature found for class 'COM.SQLCmdRunnerClass'.
Problem #3: I've also failed with this attempt:
public object[,] RunStoredProc(string strProcName, params object[] args)
I have already successfully call simple function within the dll/COM object, for example, "PerformAddtiion" (above). I just need to pass Matrix/Array in and out.
Thanks
dev
modified on Monday, August 3, 2009 12:39 AM
|
|
|
|

|
Hi all, I have installed Matlab R2008a and a colleague has provided me with a C-compiled (R2008b) of an M-file.
I'm using .net to access that library with no success (I'm given two linker errors back):
- error LNK2019: unresolved external symbol _mxGetPr_proxy referenced in function _main
- error LNK2019: unresolved external symbol _mxCreateDoubleMatrix_730_proxy referenced in function _main).
Do you know if there's any solution to that?
The folders (includes and libraries) are pointing at: development folder, matlab\extern\lib\win32, matlab\extern\include
The source code, basically, is:
#include "stdafx.h"
#include "ect.h"
#include ;
#pragma comment(lib, "libmx.lib")
#pragma comment(lib, "libmat.lib")
#pragma comment(lib, "libmex.lib")
#pragma comment(lib, "libeng.lib")
#pragma comment(lib, "ect.lib")
void main(void)
{
double takeUpAux[1] = {1.3300};
bool rdo = false;
mxArray *takeUp, *ECTcalc;
takeUp=mxCreateDoubleMatrix(1, 1, mxREAL);
memcpy(mxGetPr(takeUp), takeUpAux, sizeof(double));
ectInitialize();
rdo=mlf_prognosticate_ECT(1, &ECTcalc, takeUp);
ectTerminate();
mxDestroyArray(takeUp);
mxDestroyArray(ECTcalc);
}
However if I include #pragma comment(lib, "mclmcrrt.lib"), the program compiles but when debugging it stops at memcpy(...) because takeUp is pointing to 0x000000 address.
Any idea?
Oscar ... getting mad
|
|
|
|

|
Before using your library, my code used a MAT file writing/reading library. My coded wrote a MAT file, executed a command line Matlab instance to process the variables, and then readed the resulting MAT file.
This process could be accelerated if I used Named Pipes instead of actual files.
Thanks for your solution! I think that my former approach will never have the same performance as yours.
|
|
|
|
|

|
Hi!
Did I see right, if i didn't find a possibility to get MatLab-pictures as Metafilepict over DDE-connection with Matlab as server?
I think that should be possible over the EngFigureResult, but I'm not sure, how to do it.
If that's right, do anyone have an idea, how to integrate this?
Fabian
|
|
|
|

|
HI,
I Created a Windows GUI using Microsoft MFC. This created a .exe file. I want to invoke this GUI in MATLAB. How is this done? Can anyone help me please...
|
|
|
|

|
Which matlab version is this? I'm having problem running your test example Image project, and i have ver7.
I suspect the versions is the cause. The error it brings is "unable to load 'libeng.dll'". i even dropped it in system32, nothing.
|
|
|
|

|
Uninstall you Mathlab copy.
Then goto Mathlab Website. And read documentation. Installation Guide.
Latest Versions are R2007a / R2007b.
Up to date version is R2008a
|
|
|
|

|
Put the <MATLAB root>\bin\win32 folder in your PATH and restart.
|
|
|
|

|
Hi,
I have a c++ application which uses Matlab engine to save
data for further use with Matlab. I need to distribute the
application to users that do not have Matlab. Is there a
way tp use Matlab Engine with Matlab Runtime Component ?
How should I change the compilation to do it ?
Thanks,
Ofra
|
|
|
|

|
hi.
Read MCR. Part of MatLab doccumentation. DotNet compiler.
When you compile your DLL mathlab library functions. Use setting and click on MCR optionBox for an autoInstallation of your MathLab Generated DLL. on target computer.
hen no need for him to have Mathlab Instaled.
It works fine.
|
|
|
|

|
Hi, I assume you are referring to the Matlab Compiler Runtime and the latest documentation (R2012a) states..
[..] you cannot run the MATLAB engine on a machine that only has the MATLAB Compiler Runtime (MCR).
(Source)
From my experience the same is true for older versions.
|
|
|
|

|
I'm interested in using it with the CSIM (Circuit Simulator) package.
CSIM is writen in C++ and uses a MEX interface to Matlab.
Can I do this?
|
|
|
|

|
hi ,
i am given a .p file which can generate .txt files of some sort from matlab model .
i want to run that from my c#.net application by invoking matlab from my app .
kindly give me step by step solution as i am lost with all the solutions suggested on line .
|
|
|
|

|
create an instance in C#.net and call the function or method of .p and this .p file returns someoutput and returns this output to a variable in C#. do the operation u want
|
|
|
|

|
kindly explain in detail what instance do i have to create ?
|
|
|
|

|
Hi,
Can I use matlab to create a dll file for example to solve a polynomial or do NewtonRophson and then use it in C#.Net.
If it is possible please tell me how. I'll appreciate you alot.
Best Regards
|
|
|
|

|
Hi,
I am also interested to know the same. We have to make a webservice which can do optimization and input out put analysis using matlab. Please let me know if you have any idea how this can be done
|
|
|
|
|

|
I've tried to use Com Interface - using library MLapp.
The problem here is that I'm not able to create more than one matlab connection from the same .net session. I do the following:
matlab = new MLApp.MLAppClass();
string Result = matlab.Execute("cd ..\\..\\work");
matlab1 = new MLApp.MLAppClass();
string Result = matlab1.Execute("cd ..\\..\\work");
And here I hoped to get two sessions of matlab, but I always get only one. Moreover, all the execute commands are being executed in the same opened matlab environment.
Any idea?
|
|
|
|

|
in the MATExplorer,there are the code to show the structure:
public void RefreshView()
{
mtxView.Items.Clear();
if(!mat.IsOpened)
return;
NamedMatrixCollection mtx = mat.Variables;
foreach(string s in mtx.Keys)
{
MatrixDescription md = mtx[s];
ListViewItem lvi = new ListViewItem(new
string [] { md.Name, md.TypeName, md.Rows.ToString(), md.Cols.ToString()});
mtxView.Items.Add(lvi);
}
}
my question is ,can u tell me ,how to show the date in the matrix?
|
|
|
|

|
I have MATLAB Component Runtime 7.2 installed (not with Matlab IDE, just the runtime components)
When using the COM method,
matObject = Interaction.CreateObject("Matlab.Application","")
this line gives the exception
"An unhandled exception of type 'System.Exception' occurred in microsoft.visualbasic.dll
Additional information: Cannot create ActiveX component."
Also when using the Matlab engine method:
engine = MATInvoke.engOpen(null)
This always returns zero. Due to this no other operations are performed.
Do any body know why is the Engine not starting up?
When I was born, I was so surprised I didn't talk for a year and a half.
|
|
|
|

|
I cannot find the matrix class which supports direct access to matrices, stored with different formats. I do not think it exists inside MATNET Library...
|
|
|
|

|
Emanuele Ruffaldi,I have met the same question.Could you tell me how to solve it?
|
|
|
|

|
After studying many useful articles including the above one, I collected some samples codes to make a C# console application. For me, it is enough.
/*
* Launch Matlab, run commands, and retrieve data.
*
* You should Matlab installed.
* You should add MLApp to References by selecting COM - MATLAB Application (version x.x) Type Library.
* You should add Microsoft.VisualBasic by selection .NET - Microsoft.VisualBasic to References.
*
* Environment: MATLAB 7.0 / Visual Studio 2005 / Windows XP SP2
*
* References
* http://www.mathworks.com/support/solutions/data/1-1B3JH.html?solution=1-1B3JH
* http://groups.google.co.kr/group/comp.soft-sys.matlab/browse_thread/thread/4216ae30b064447f/61faffad8e1980a2?lnk=st&q=matlab+invokemember&rnum=1#61faffad8e1980a2
* http://www.codeproject.com/dotnet/matlabeng.asp
* http://www.mathworks.com/access/helpdesk/help/techdoc/ref/index.html?/access/helpdesk/help/techdoc/ref/getfullmatrix.html&http://www.mathworks.com/cgi-bin/texis/webinator/search?pr=Whole_site&db=MSS&prox=page&rorder=750&rprox=750&rdfreq=500&rwfreq=500&rlead=250&sufs=0&order=r&whole=Whole_site&entire_flag=1&is_summary_on=1&ResultCount=10&query=getfullmatrix&submit=Search
* http://groups.google.co.kr/group/comp.soft-sys.matlab/browse_thread/thread/373bf10951ca2759/c82bab39c20fbc3e?lnk=st&q=InvokeMember+GetFullMatrix&rnum=2#c82bab39c20fbc3e
* http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/index.html?/access/helpdesk/help/techdoc/matlab_external/f135616.html&http://www.google.co.kr/search?hl=ko&newwindow=1&rls=GGGL%2CGGGL%3A2006-14%2CGGGL%3Ako&q=MLApp.MLAppClass+matlab+%3D+new+MLApp.MLAppClass%28%29%3B&btnG=%EA%B2%80%EC%83%89&lr=
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.IO;
using Microsoft.VisualBasic;
namespace ConsoleApplicationMatlabCom
{
class Program
{
static void Main(string[] args)
{
// References
// http://www.mathworks.com/support/solutions/data/1-1B3JH.html?solution=1-1B3JH
string path = Directory.GetCurrentDirectory();
// Matlab command
// At the first part of the command, I change working directory to the current directory
string command = "cd " + "'" + path + "'" + ", suf(peaks), print -djpeg fig_surf, a = 1, b = [2 3 4], i = [5 6 7; 8 9 10]";
// Get the type info
Type matlabtype;
matlabtype = Type.GetTypeFromProgID("matlab.application");
// Create an instance of MATLAB
object matlab;
matlab = Activator.CreateInstance(matlabtype);
// Prepare input as an object
object[] arrayInput = new Object[] { command };
// Call MATLAB method
// In the following reference, FullMatrix, PutCharArray, and GetCharArray functions
// can be called through InvokeMember(). However, it says GetFullMatrix does not work correctly.
// http://groups.google.co.kr/group/comp.soft-sys.matlab/browse_thread/thread/4216ae30b064447f/61faffad8e1980a2?lnk=st&q=matlab+invokemember&rnum=1#61faffad8e1980a2
// The result obtained by Execute is just an object (a string). Therefore, one should convert it to numerical values
// to use it his/her codes.
object result;
result = matlabtype.InvokeMember("Execute", BindingFlags.InvokeMethod, null, matlab, arrayInput);
Console.WriteLine(result.ToString());
// Get matrix from MATLAB workspace
// GetFullMatrix() is useful to retrieve workspace numeric variables.
// You don't need to make a parser as for Execute()
// http://www.mathworks.com/access/helpdesk/help/techdoc/ref/index.html?/access/helpdesk/help/techdoc/ref/getfullmatrix.html&http://www.mathworks.com/cgi-bin/texis/webinator/search?pr=Whole_site&db=MSS&prox=page&rorder=750&rprox=750&rdfreq=500&rwfreq=500&rlead=250&sufs=0&order=r&whole=Whole_site&entire_flag=1&is_summary_on=1&ResultCount=10&query=getfullmatrix&submit=Search
int nrow = 2;
int ncol = 3;
object[] parameters = new object[] { "i", "base", new Double[nrow, ncol], new Double[0] };
bool [] argsCallBack = new bool[4] { false, false, true, false };
// As mentioned above, calling GetFullMatrix() through InvokeMember() does not seem to work.
// In the following reference, a simple work-around method is described.
// http://groups.google.co.kr/group/comp.soft-sys.matlab/browse_thread/thread/373bf10951ca2759/c82bab39c20fbc3e?lnk=st&q=InvokeMember+GetFullMatrix&rnum=2#c82bab39c20fbc3e
// the poster uses Visual Basic COM binder instead of reflection method.
// Therefore, you need to add "Microsoft.VisualBasic" to references of your project.
Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(matlab, null, "GetFullMatrix", parameters, null, argsCallBack);
double[,] data;
data = (double[,])parameters[2];
for (int i = 0; i < nrow; i++)
{
string data_string = null;
for (int j = 0; j < ncol; j++)
{
data_string += data[i, j].ToString();
data_string += " ";
}
Console.WriteLine(data_string);
}
// The code in the following URL should do same works.
// However, in my machine, it crashes with an unhandled exception.
// http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/index.html?/access/helpdesk/help/techdoc/matlab_external/f135616.html&http://www.google.co.kr/search?hl=ko&newwindow=1&rls=GGGL%2CGGGL%3A2006-14%2CGGGL%3Ako&q=MLApp.MLAppClass+matlab+%3D+new+MLApp.MLAppClass%28%29%3B&btnG=%EA%B2%80%EC%83%89&lr=
}
}
}
|
|
|
|

|
I get this:
??? Undefined function or method 'suf' for input arguments of type 'double'.
|
|
|
|

|
Hi Mah Jin Khai,
I used mcc to generate the DLL for an m file
But it did not generate any install.bat
also i am not able to add this DLL in C# by using add reference
My basic requirement is i should be able to call a matlab program from C# directly
can you help me with this issue
HemKiran
|
|
|
|
|

|
in this library converter for Format32bppRgb and other given but they simply just don't work for a png format. so i got the pixel format of png file.. that is Format32bppArgb
i really need this conveter that converts a png file to Matrix. if any one of u have this converter then plzz tell me
mail me at
adilgul@rediffmail.com
Regards
Adil
|
|
|
|

|
hi
please
i build acom object in matlab and i make it refrence in c# but i dont know how to write a code in c# for calling m file and sending data to mfile from c# and show the output which is figure
please help me
amal_alquds
|
|
|
|

|
could I use EngMATLib in ASP.NET? especially with C# code behind. I already try to use it, but it doesn't give me the right result.
|
|
|
|

|
I have some prblems with getting my DLL to work in C# (VS 2005). I have tried both your way and the COM-way. Could you post a more precise way of the first option? I have created a DLL in Matlab using the comtool. My function is called doubleup.m. When I use the comtool the DLL ends up having the namespace MyMatlabFunctions with the class MyFunc. I cannot import the DLL into C# since it will crash VS, but I can add it as a COM component. To call my function I have to create a MyFunc object but MyMatlabFunctions.MyFunc mat = new MyMatlabFunctions.MyFunc(). I can then see the function MyFunc.doubleup() but instead of requesting only one argument (a number) it now has got the signature (int i, ref object y, object x). What does this mean and how to I use it?
Also, with the solution I currently use the code looks like below. I haven't been able to find much information about InvokeMember but the CreateObject method you use, and x.Exceute is nowhere to be found. I really like to be able to use the approach I first described since it better reflects a normal object usage in c#.
Thanks on beforehand
Michael Rozenberg
mikey [dot] rozenberg gmail [dot] com
current code:
-------------------
Type matlabtype;
matlabtype = Type.GetTypeFromProgID("matlab.application");
//Create an instance of MATLAB
object matlab;
matlab = Activator.CreateInstance(matlabtype);
//Prepare input as an object
object[] arrayInput = new Object[] {"doubleup(5)"};
//Call MATLAB method
matlabtype.InvokeMember("Execute",BindingFlags.InvokeMethod,null,matlab,arrayInput);
|
|
|
|

|
anyone can tell me the speed of using matlab and also engmatlib?
i have use .dll on my c# program, but feeling .dll is damn slow, so EngMatLib.dll helps me a lot.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
A library to access MATLAB from .NET and a comparision of three possible methods to implement it.
| Type | Article |
| Licence | |
| First Posted | 18 Nov 2003 |
| Views | 312,521 |
| Bookmarked | 105 times |
|
|