I am looking for a simple C# example implementing a typesafe interface to a complied MATLAB DLL using R2017b Compiler and VS2017

2 ビュー (過去 30 日間)
Larry
Larry 2018 年 3 月 5 日
編集済み: Larry 2018 年 3 月 5 日
I used the R2017b MATLAB compiler to build and install built AddMaster.DLL. No problems on this part.
function y = addOne(x)
y = x + 1;
end
Below is my (weak) attempt a a C# program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// using System.ServiceModel;
using AddMaster;
namespace LKTypeSafe
{
public interface IAddOne
{
int AddOne(int x);
}
class AddOneCls2 : IAddOne
{
public int AddOne(int x)
{
IAddOne obj = new AddMaster.addOne(int x);
int two = 0;
return two = obj.AddOne(x);
}
}
class AddMaster
{
static void Main(string[] args)
{
Console.WriteLine("Starting LKTypeSafe");
AddOneCls obj = null;
int input = 0;
try
{
// Instantiate your component class.
obj = new AddOneCls2();
// Invoke your component.
int output = obj.addOne(input);
// print the output.
Console.WriteLine(output);
Console.Write("\nPress any key to exit...");
Console.ReadKey(true);
}
catch
{
throw;
}
}
}
}
Step by step help on using VS2017 to build this simple example is requested. Any Help is appreciated.

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Compiler SDK についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by