RosettaCodeData/Task/Associative-array-Iteration/MATLAB/associative-array-iteration-1.m

7 lines
194 B
Mathematica
Raw Permalink Normal View History

2013-04-10 15:42:53 -07:00
keys = fieldnames(hash);
for k=1:length(keys),
key = keys{k};
value = getfield(hash,key); % get value of key
hash = setfield(hash,key,-value); % set value of key
end;