how to pass to a .NET object a struct ?

조회 수: 2 (최근 30일)
timo
timo 2015년 4월 25일
I know that a limitation is that u cannot pass to a .NET queue element a struct or array of structs.
My requirement is that I have queues whose elements are matlab structs elements How can I use the .NET Queue with MATLAB native structs? I mean is there a extra step trick I could do ?
Example: I have 5 MATLAB structs elements who I want to put in a .NET Queue and the use push , get from the .NET Queue who will get or put in queue structs elememts....
I tried with Numbers and it works,
t = NET.createGeneric('System.Collections.Generic.Queue',{'System.Double'},10);
t.Enqueue(1)
t.Enqueue(2)
t.Enqueue(3)
x=t.GetEnumerator();
while x.MoveNext();
disp(x.Current)
end
but when I try to use structs I get an error
t = NET.createGeneric('System.Collections.Generic.Queue',{'System.Object'},10);
c=struct('cockyStruct',1);
No method 'Enqueue' with matching signature found for class 'System.Collections.Generic.Queue<System*Object>'.
Is there a trick or extra step I could do ?

답변 (0개)

카테고리

Help CenterFile Exchange에서 .NET Methods in MATLAB에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by