Reputation: 29
I want to pass matrix as input from .net app to matlab function
Matlab function:
function myfunc(info);
sort(info)
end
I want info input be recieved in function like this:
info = [...
0 0 0; ...
0 120 0; ...
240 120 0; ...
240 0 0; ...
];
and .net code:
MLApp.MLApp matlab = new MLApp.MLApp();
matlab.Execute(@"cd C:\scripts\myfunc.m");
object result = null;
int[,] input = new int[4, 3] { { 0, 0, 0 }, { 0, 120, 0 }, { 240, 120, 0 }, { 240, 0, 0 } };
matlab.Feval("myfunc", 0, out result, input);
This gives me error in Feval line--> "error using norm first argument must be single or double."
And when I change input to be like this
int[,,] input = new int[4, 1, 3] {
{ {0, 0, 0} },
{ {0, 120, 0} },
{ {240, 120, 0} },
{ {240, 0, 0} }
};
It gives another error --> 'index in position 1 exceeds array bounds. index must not exceed 1
How to solve this?
Upvotes: 0
Views: 18