From 2244ffc6eefc94e7d1679b8fe525bbcd6fbb9180 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Hermes=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Tue, 12 Jul 2016 17:51:41 +0200
Subject: [PATCH] Added instantiation from a Matlab table.

Need to add unit tests for this.
---
 src/@dseries/dseries.m | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/@dseries/dseries.m b/src/@dseries/dseries.m
index f185a94..ac2367c 100644
--- a/src/@dseries/dseries.m
+++ b/src/@dseries/dseries.m
@@ -103,6 +103,13 @@ classdef dseries<handle % --*-- Unitary tests --*--
                     else
                         o.tex = tex;
                     end
+                elseif istable(varargin{1})
+                    % It is assumed that the dates are in the first column.
+                    thistable = varargin{1};
+                    o.name = varargin{1}.Properties.VariableNames(2:end);
+                    o.tex = name2tex(o.name);
+                    o.data = varargin{1}{:,2:end};
+                    o.dates = dates(varargin{1}{1,1}{1})+(0:size(varargin{1}, 1)-1);
                 elseif isnumeric(varargin{1}) && isequal(ndims(varargin{1}),2)
                     o.data = varargin{1};
                     o.name = default_name(vobs(o));
-- 
GitLab