Return Struct from .net dll
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu JSON Format finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!