Hi Kartik,
From what I understand based on the code and error message you provided, it seems that you are encountering an issue while calling a specific “.NET” function (“FrequencyCalibration”) in MATLAB. The code you shared works correctly in C# but fails to work when called from MATLAB.
Here are a few suggestions to resolve the issue:
- Array Initialization: Instead of using “NET.createArray” to initialize the “genArr” array. You can try using MATLAB's array creation syntax directly.
For example, you can replace the line genArr = NET.createArray('System.Double', nsamples*probetype); with genArr = zeros(1, nsamples*probetype);.
- Check the Method Signature: Ensure that the method signature of the “FrequencyCalibration” function in the “.NET” code matches the way you are calling it from MATLAB. Check the number and types of arguments being passed, as well as the return type. Make sure that they match the expected signature in the “.NET” code.
- Data Type Conversion: Verify that you are correctly converting the data types when passing data between MATLAB and “.NET”. Ensure that the data types of the arguments being passed to the “FrequencyCalibration” function in MATLAB match the expected data types in the “.NET” code.
Attached below are some documentation links that you may find helpful:
Hope this helps!