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

조회 수: 1 (최근 30일)
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 CenterFile Exchange에서 Java Package Integration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by