From e05dcdc34bdd4d942b106de2e94f74ebcda7d0c9 Mon Sep 17 00:00:00 2001 From: Michael Stumpf Date: Fri, 7 Dec 2018 15:16:45 +0100 Subject: [PATCH] column map converter --- matlab/convert_particles_array_colmap.m | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 matlab/convert_particles_array_colmap.m diff --git a/matlab/convert_particles_array_colmap.m b/matlab/convert_particles_array_colmap.m new file mode 100644 index 0000000..dc0fd3c --- /dev/null +++ b/matlab/convert_particles_array_colmap.m @@ -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 \ No newline at end of file