From dfd25f4a2908b14e441f7658026ef2323ceca5a1 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Tue, 24 Jun 2014 15:56:16 +0000
Subject: [PATCH] needed to adapt EQI etc time bases

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@4470 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/AUG/adaptPFM_rda.m | 17 +++++++++++++++++
 crpptbx/AUG/adapt_rda.m    | 22 ++++++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 crpptbx/AUG/adaptPFM_rda.m
 create mode 100644 crpptbx/AUG/adapt_rda.m

diff --git a/crpptbx/AUG/adaptPFM_rda.m b/crpptbx/AUG/adaptPFM_rda.m
new file mode 100644
index 00000000..cd73a1d9
--- /dev/null
+++ b/crpptbx/AUG/adaptPFM_rda.m
@@ -0,0 +1,17 @@
+function [nodeout]=adaptPFM_rda(nodein,ndim1,ndim2,ndim3);
+%
+% 3D case is special
+%
+% adapt nodein to keep only 1st ndim1 points in dim1 and ndim2 points in dim2 and same for ndim3
+%
+% re-generate .x and .t
+%
+% change .value, .data, .x and .t 
+%
+
+nodeout = nodein;
+
+nodeout.value = nodeout.value(1:ndim1,1:ndim2,1:ndim3);
+nodeout.data = nodeout.value;
+nodeout.x = [1:ndim1];
+nodeout.t = [1:ndim3];
diff --git a/crpptbx/AUG/adapt_rda.m b/crpptbx/AUG/adapt_rda.m
new file mode 100644
index 00000000..58e4fd9b
--- /dev/null
+++ b/crpptbx/AUG/adapt_rda.m
@@ -0,0 +1,22 @@
+function [nodeout]=adapt_rda(nodein,ndim1,ndim2,itotransposeback,varargin);
+%
+% adapt nodein to keep only 1st ndim1 points in dim1 and ndim2 points in dim2
+% if itotransposeback==1, transpose back matrix and use ndim1 for ndim2 and vice versa
+%
+% change .value, .data, .x and .t 
+%
+
+nodeout = nodein;
+
+if itotransposeback==1
+  nodeout.value = nodeout.value';
+  nodeout.data = nodeout.data';
+  temp = nodeout.x;
+  nodeout.x = nodeout.t;
+  nodeout.t = temp;
+end
+
+nodeout.value = nodeout.value(1:ndim1,1:ndim2);
+nodeout.data = nodeout.value;
+nodeout.x = nodeout.x(1:ndim1);
+nodeout.t = nodeout.t(1:ndim2);
-- 
GitLab