How to get dimensions of MATLABArray using MATLABEngine with .NET
Mostrar comentarios más antiguos
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 comentarios
Nolin Borrero Jr
el 22 de Mayo de 2024
prabhat kumar sharma
el 3 de Jun. de 2024
Editada: prabhat kumar sharma
el 3 de Jun. de 2024
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
el 3 de Jun. de 2024
Michael VanMeter
el 4 de Jun. de 2024
Editada: Michael VanMeter
el 4 de Jun. de 2024
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
el 4 de Jun. de 2024
Respuestas (0)
Categorías
Más información sobre Call MATLAB from .NET en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
