clc
clear
data = xlsread('test.xls');
%data = [213456 258
% 131231 741
% 785454 369
% 741513 548];
idx = containers.Map({7898789},{111111});
flow_num = [];
data
%% MAP 索引映射 实操
for i=1:length(data)
disp(i)
try
dx = idx(data(i,1));
flow_num(dx) = flow_num(dx) + data(i,2);
catch
idx(data(i,1)) = length(flow_num) + 1;
dx = length(flow_num) + 1;
flow_num(dx) = data(i,2);
end
end
flow_num
%MAP常用方法
% containers.map({},{})
% keys(map)
% values(map)
% remove(map,key)
%索引方式和矩阵很相似 ,赋值和修改操作都通过索引修改