Return Struct from .net dll
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a .net DLL (C#) that receives real-time (and lots) of data over TCP from a sensor. The data is coming as arrays of custom objects. (call it a SensorPacket, that has about 20 fields, mostly float and int).
I have been sending this up to matlab via events (works fine). But Matlab sees them as an array of .NET objects. I would prefer to send this up as a array of struct. How?
yes, one can convert this array to a cell array via:
but that still leaves this as a cell array of .net objects. Can one cast the objects so that I can get the values?
and better would be to send a cell/array of struct.
I had tried converting this to JSON, and using a matlab JSON reader to convert to structs, but this is very very slow: http://www.mathworks.com/matlabcentral/fileexchange/33381-jsonlab--a-toolbox-to-encode-decode-json-files
Don't laugh, but I am thinking of using the DLL to write a .MAT file, and then send up the handle to that to Matlab. This writer might work: http://www.mathworks.com/matlabcentral/fileexchange/16319-csmatio--mat-file-i-o-api-for-net-2-0
In the following page, it says I can return a struct or a class, but my experience is that this returns a System.Object
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre JSON Format en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!