Feval (com) turns MWCharArray input to NaN

Hi, I'm trying to call a MATLAB script from c# via the COM interface. The program should pass a json string to matlab, do some calculations an pass it back:

MLApp.MLApp matlab = new MLApp.MLApp();
string jsonString = myfunc();
MWCharArray mlInput = new MWCharArray(jsonString);
matlab.Feval(scriptName, 1, out object result, mlInput);

The matlab script behind scriptName calls jsondecode() on mlInput and immediately throws an error, that the input for jsondecode has to be a character vector. When I display the mlInput from within matlab, it only shows me a NaN, but the mlInput is a valid json string at runtime on the c# side. If i try to input the c# string, the matlab script just crashes without any error message. I don't understand what is happening. Can anyone help?

Antworten (0)

Produkte

Gefragt:

am 19 Apr. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by