From 034f8378fd3804252545b79a1b905d7570e734b2 Mon Sep 17 00:00:00 2001
From: Cristian Galperti <cristian.galperti@epfl.ch>
Date: Wed, 17 Jul 2019 14:17:12 +0200
Subject: [PATCH] Best accordance between sim and MARTe on 1005

---
 code/classes/SCDclass_mdswgsigarray1.m | 6 ++++++
 code/classes/SCDclass_mdswgsigsingle.m | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/code/classes/SCDclass_mdswgsigarray1.m b/code/classes/SCDclass_mdswgsigarray1.m
index e91c740..268f288 100644
--- a/code/classes/SCDclass_mdswgsigarray1.m
+++ b/code/classes/SCDclass_mdswgsigarray1.m
@@ -117,7 +117,13 @@ classdef SCDclass_mdswgsigarray1 < SCDclass_mdswg
             
                 dbdata=mdsvalue(mdschannel);
                 dbtime=mdsvalue(['dim_of(' mdschannel ')']);
+                
                 value.Data(:,ii) = single(interp1(dbtime,dbdata,timebase,'linear',0))';
+                firstindexes=find(timebase<dbtime(1));
+                lastindexes=find(timebase>dbtime(end));
+                value.Data(firstindexes,ii)=single(dbdata(1));
+                value.Data(lastindexes,ii)=single(dbdata(end));
+                
             end    
                 
         end
diff --git a/code/classes/SCDclass_mdswgsigsingle.m b/code/classes/SCDclass_mdswgsigsingle.m
index d204baa..e4cbbe7 100644
--- a/code/classes/SCDclass_mdswgsigsingle.m
+++ b/code/classes/SCDclass_mdswgsigsingle.m
@@ -97,6 +97,12 @@ classdef SCDclass_mdswgsigsingle < SCDclass_mdswg
             dbdata=mdsvalue(obj.tdiexpr);
             dbtime=mdsvalue(['dim_of(' obj.tdiexpr ')']);
             value.Data = single(interp1(dbtime,dbdata,timebase,'linear',0))';
+            
+            firstindexes=find(timebase<dbtime(1));
+            lastindexes=find(timebase>dbtime(end));
+            value.Data(firstindexes)=single(dbdata(1));
+            value.Data(lastindexes)=single(dbdata(end));
+
         end
         
         
-- 
GitLab