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

7 lines
186 B
Mathematica
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
keys = fieldnames(hash);
for k=1:length(keys),
key = keys{k};
value = hash.(key); % get value of key
hash.(key) = -value; % set value of key
end;