column map converter

This commit is contained in:
Michael Stumpf 2018-12-07 15:16:45 +01:00
parent 261f685463
commit e05dcdc34b
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
function [pp2] = convert_particles_array_colmap(pp1,col1,col2)
% [pp2] = convert_particles_array_colmap(pp1,col1,col2)
% Converts particle array data with colmap 1 to array with colmap 2
% Input
% pp1 original particle data in 'array' format
% col1 column map of pp1
% col2 new column map
% Output
% pp2 particle data with column map col2
ncol2 = col2.Count;
np = size(pp1,2);
nt = size(pp1,3);
pp2 = zeros(ncol2,np,nt);
col2keys = col2.keys;
for it=1:nt
for icol=1:ncol2
key = col2keys{icol};
if col1.isKey(key)
pp2(icol,:,it) = pp1(col1(key),:,it);
end
end
end
end