Hi all,
i’d like to iterate processing on each element of an existing list object, while the processing is actually updating the content of the element as in the code :
st=struct("a",1,"b",3)
l=list(st, st, st)
for e=l //automatic iteration on element of the list l through e 'pointer'
e.a=e.a+1; //update content of the element
e.c="newfield"; //add new field to the original element (structure)
end
l
and the result is leaving the original l list object unchanged.
→ l=list(st, st, st)
l = (3-elements list)
(1): [struct] with fields:
a = 1
b = 3
(2): [struct] with fields:
a = 1
b = 3
(3): [struct] with fields:
a = 1
b = 3→ for e=l
e.a=e.a+1; e.c="newfield"; end→ l
l = (3-elements list)
(1): [struct] with fields:
a = 1
b = 3
(2): [struct] with fields:
a = 1
b = 3
(3): [struct] with fields:
a = 1
b = 3
Is there any way to apply the elementary operations (e.) on the original list l , something like a pointer still using the automatic iteration syntax ?
Thanks
David