Thursday, January 24, 2019

Get MATLAB version and license number from C# project



try
{
    var matlab = new MLApp.MLApp();

    matlab.Feval("version", 1, out var result2);
    var matlabVersion = (result2 as Object[])[0] as String;
    Console.WriteLine($"MATLAB version: '{matlabVersion}'");

    matlab.Feval("license", 1, out var result1);
    var matlabLicense = (result2 as Object[])[0] as String;
    Console.WriteLine($"MATLAB license: '{matlabLicense}'");
}
catch (Exception ex)
{
    Console.WriteLine("MATLAB is not installed");
}

No comments:

Post a Comment