How to get dimensions of MATLABArray using MATLABEngine with .NET
이전 댓글 표시
When using a MathWorks.MATLAB.Types.MATLABArray, how do you get the dimensions of the array? I cannot find any properties that expose it.
댓글 수: 5
Nolin Borrero Jr
2024년 5월 22일
prabhat kumar sharma
2024년 6월 3일
편집: prabhat kumar sharma
2024년 6월 3일
You can try with the "Feval" Function and Let me know if it works.
object result = matlabEngine.Feval("size", 1, matlabArray);
object[] resultArray = result as object[];
Nolin Borrero Jr
2024년 6월 3일
Michael VanMeter
2024년 6월 4일
편집: Michael VanMeter
2024년 6월 4일
As you pointed out there are no public members exposed for the information you seek. Why are you trying to operate on the MATLABArray class and not converting to a native .NET type?
using MathWorks.MATLAB.Engine;
using (dynamic matlab = MATLABEngine.StartMATLAB())
{
double[,] results = matlab.magic(5.0);
int rows = results.GetLength(0);
int cols = results.GetLength(1);
}
Nolin Borrero Jr
2024년 6월 4일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Call MATLAB from .NET에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
