Pass an image to a function from C#
3 ビュー (過去 30 日間)
古いコメントを表示
I'm preparing the C# portion of my project and am trying to set up an environment in C# which allows me to pass an image to a matlab function, let matlab do its job, and return a boolean or integer representation of the boolean. So in short, the return value isn't anything special and works fine, but the argument causes troubles. Now matlab functions happily take images and any other formats as arguments, but C# seems to only be able to pass strings or atomic values. So when I try to pass a bitmap as a parameter, I get:
"The file name or URL argument must be a string."
As an error message. And yes, it remains the same error message when I pass the path of the image. So it's not really the matlab side causing the problem. I'm using visual studio 2015 and matlab version 2015b, and they seem to cooperate nicely when I'm passing simple variables and returning simple variables. The function call is defined as this:
matlab.Feval("testFile", 2, out result, path);
If anyone has any idea your help would be greatly appreciated!
0 件のコメント
回答 (1 件)
Subhra Saha
2015 年 11 月 9 日
Hi Ron,
To pass an image from C# to MATLAB function, you can use MWArrays as mentioned in the following link:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で MATLAB Compiler についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!