How do I load a c# code from visual studios so that it works in MATLAB?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have the following code written in C sharp:
using System;
//Here we are importing the libraries provided by Scientifica itself
using Scientifica.LLII_Client;
using Scientifica.LLII_Client.Commands;
using Scientifica.LLII_Client.Util;
namespace LinLab2_Client_Example //Name of the project
{
class Program
{
private static LL2Client _Client;
static void Main(string[] args)
{
//You need to include the LLII_Client.dll in your project
//find connection options for connection on the same computer
ConnectionOptions options = ConnectionOptions.GetOptionsFromFile();
_Client = new LL2Client(options); //You need to keep this object whilst you are using the connection do not recreate it everytime
Console.WriteLine("X positon:");
string X_pos = Console.ReadLine();
double convertedX_pos;
double.TryParse(X_pos, out convertedX_pos);
Console.WriteLine("Y positon:");
string Y_pos = Console.ReadLine();
double convertedY_pos;
double.TryParse(Y_pos, out convertedY_pos);
Console.WriteLine("Z positon:");
string Z_pos = Console.ReadLine();
double convertedZ_pos;
double.TryParse(Z_pos, out convertedZ_pos);
Console.WriteLine("The coordinate positions are: {0}, {1}, {2}", convertedX_pos, convertedY_pos, convertedZ_pos);
while (true)
{
Console.WriteLine("Press enter to report cards positions");
Console.ReadLine();
//Report position of V1 motion cards
foreach (var card in _Client.Motion1Cards)
{
card.MoveAbsolute(convertedX_pos, convertedY_pos, convertedZ_pos);
Position p = card.Position;
Console.WriteLine("Desc:{0}, X:{1}, Y:{2}, Z:{3}", card.Description, p.X, p.Y, p.Z);
}
//Report position of V2 motion cards
foreach (var card in _Client.Motion2Cards)
{
Position p = card.Position;
Console.WriteLine("Desc:{0}, X:{1}, Y:{2}, Z:{3}", card.Description, card.PositionX, card.PositionY, card.PositionZ);
}
}
}
}
}
I want to this code from MATLAB such that the command window shows what the console application does in Visual studios. I believe I have to call an external .NET function.
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Deploy to .NET Applications Using MWArray API en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!