1
如何迭代/循環結構數組字段的值。迭代結構數組字段的值
對於1x1的結構
student = struct();
student.name = 'jim';
student.gpa = 1.9;
我這樣做:
fields = fieldnames(student)
for i=1:numel(fields)
var = fields(i)
end
但我不如何遍歷1×2:
student = struct();
student(1).name = 'jim';
student(1).gpa = 1.9;
student(2).name = 'ryan';
student(2).gpa = 1.5;
再次感謝噸Suever .... –
我剛剛意識到這* fields {m} * cell array,再次感謝 –