我Int32
在Matlab中创建了一个包含五个整数的列表:
genType = NET.GenericClass('System.Collections.Generic.List',...
'System.Int32');
arr = NET.createArray(genType, 5)
现在,我不知道如何将元素添加到列表中。
我尝试使用以下方法失败:
arr.SetValue(1)
arr.SetValue(1,1)
arr.SetValue(1,1,1,1)
arr(1)=1
...ETC。
试用以下代码,它应该可以帮助您入门:
list = NET.createGeneric('System.Collections.Generic.List',...
{'System.Int32'},100);
list.Add(5)
list.Add(6)
for i = 0:list.Count - 1
disp(list.Item(i))
end
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句