Index: branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/Regression/Matlab/RegressionMatlabImportDialog.Designer.cs
===================================================================
--- branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/Regression/Matlab/RegressionMatlabImportDialog.Designer.cs	(revision 15918)
+++ branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/Regression/Matlab/RegressionMatlabImportDialog.Designer.cs	(revision 15919)
@@ -44,4 +44,6 @@
             this.LoadValuesButton = new System.Windows.Forms.Button();
             this.VariablesListBox = new System.Windows.Forms.CheckedListBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.StatusLabel = new System.Windows.Forms.Label();
             this.ProblemDataSettingsGroupBox.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.TrainingTestTrackBar)).BeginInit();
@@ -87,6 +89,7 @@
             | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
+            this.ProblemDataSettingsGroupBox.Controls.Add(this.ErrorTextBox);
+            this.ProblemDataSettingsGroupBox.Controls.Add(this.label1);
             this.ProblemDataSettingsGroupBox.Controls.Add(this.TargetVariableComboBox);
-            this.ProblemDataSettingsGroupBox.Controls.Add(this.ErrorTextBox);
             this.ProblemDataSettingsGroupBox.Controls.Add(this.PreviewLabel);
             this.ProblemDataSettingsGroupBox.Controls.Add(this.TestLabel);
@@ -105,5 +108,5 @@
             this.TargetVariableComboBox.BackColor = System.Drawing.SystemColors.Control;
             this.TargetVariableComboBox.FormattingEnabled = true;
-            this.TargetVariableComboBox.Location = new System.Drawing.Point(12, 20);
+            this.TargetVariableComboBox.Location = new System.Drawing.Point(256, 19);
             this.TargetVariableComboBox.Name = "TargetVariableComboBox";
             this.TargetVariableComboBox.Size = new System.Drawing.Size(185, 21);
@@ -114,11 +117,11 @@
             this.ErrorTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
-            this.ErrorTextBox.Location = new System.Drawing.Point(384, 15);
+            this.ErrorTextBox.Location = new System.Drawing.Point(6, 15);
             this.ErrorTextBox.Multiline = true;
             this.ErrorTextBox.Name = "ErrorTextBox";
-            this.ErrorTextBox.Size = new System.Drawing.Size(57, 73);
+            this.ErrorTextBox.ReadOnly = true;
+            this.ErrorTextBox.Size = new System.Drawing.Size(435, 204);
             this.ErrorTextBox.TabIndex = 0;
             this.ErrorTextBox.Text = "Open a Matlab File";
-            this.ErrorTextBox.Visible = false;
             // 
             // PreviewLabel
@@ -231,4 +234,23 @@
             this.VariablesListBox.TabIndex = 22;
             // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(168, 22);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(82, 13);
+            this.label1.TabIndex = 9;
+            this.label1.Text = "Target Variable:";
+            // 
+            // StatusLabel
+            // 
+            this.StatusLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+            this.StatusLabel.AutoSize = true;
+            this.StatusLabel.Location = new System.Drawing.Point(9, 427);
+            this.StatusLabel.Name = "StatusLabel";
+            this.StatusLabel.Size = new System.Drawing.Size(37, 13);
+            this.StatusLabel.TabIndex = 23;
+            this.StatusLabel.Text = "Status";
+            // 
             // RegressionMatlabImportDialog
             // 
@@ -236,4 +258,5 @@
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(471, 457);
+            this.Controls.Add(this.StatusLabel);
             this.Controls.Add(this.MatlabVariablesGroupBox);
             this.Controls.Add(this.ProblemDataSettingsGroupBox);
@@ -275,4 +298,6 @@
     private System.Windows.Forms.CheckedListBox VariablesListBox;
     private System.Windows.Forms.ComboBox TargetVariableComboBox;
+    protected System.Windows.Forms.Label label1;
+    protected System.Windows.Forms.Label StatusLabel;
   }
 }
Index: branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/Regression/Matlab/RegressionMatlabImportDialog.cs
===================================================================
--- branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/Regression/Matlab/RegressionMatlabImportDialog.cs	(revision 15918)
+++ branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/Regression/Matlab/RegressionMatlabImportDialog.cs	(revision 15919)
@@ -9,4 +9,5 @@
 using System.Text;
 using System.Threading.Tasks;
+using System.Threading;
 using System.Windows.Forms;
 using HeuristicLab.Common;
@@ -19,4 +20,8 @@
   public partial class RegressionMatlabImportDialog : Form {
     private IMatlabConnector _mlConnector;
+    public event EventHandler<EventArgs<string>> StatusChangedEvent;
+    public event EventHandler<EventArgs<string>> ErrorOccuredEvent;
+
+
 
     /// <summary>
@@ -32,4 +37,5 @@
     /// </summary>
     private Dataset _values;
+
     public RegressionMatlabImportType ImportType {
       get {
@@ -51,5 +57,4 @@
     }
 
-
     public RegressionMatlabImportDialog() {
       InitializeComponent();
@@ -63,5 +68,10 @@
       LoadValuesButton.Click += LoadValuesButtonClick;
       TrainingTestTrackBar.ValueChanged += TrainingTestTrackBarValueChanged;
-
+      StatusChangedEvent += (s, e) => BeginInvoke((MethodInvoker)(() => StatusLabel.Text = e.Value));
+      ErrorOccuredEvent += (s, e) => BeginInvoke((MethodInvoker)(() => {
+        OkButton.Enabled = false;
+        ErrorTextBox.Text = e.Value;
+        ErrorTextBox.Visible = true;
+      }));
     }
 
@@ -78,4 +88,5 @@
     #region Events
 
+
     private void LoadValuesButtonClick(object sender, EventArgs e) {
       LoadValuesAsync();
@@ -87,5 +98,6 @@
       }
       GetVariableNamesAsync();
-    }    
+      ErrorTextBox.Visible = false;
+    }
 
     private void TrainingTestTrackBarValueChanged(object sender, System.EventArgs e) {
@@ -95,4 +107,20 @@
     #endregion
     
+    /// <summary>
+    /// Fires the ErrorOccuredEvent with the given text message.
+    /// </summary>
+    /// <param name="message"></param>
+    private void ErrorOccured(string message) {
+      ErrorOccuredEvent?.Invoke(this, new EventArgs<string>(message));
+    }
+
+    /// <summary>
+    /// Fires the StatusChangedEvent.
+    /// </summary>
+    /// <param name="text"></param>
+    private void UpdateStatus(string text) {
+      StatusChangedEvent?.Invoke(this, new EventArgs<string>(text));
+    }
+
     #region Opening and disposing of the Matlab connector
     private void OpenMatlabConnector() {
@@ -102,12 +130,15 @@
     }
 
-    private void DisposeMatlabConnector() {
-      if (_mlConnector != null) {
-        _mlConnector.Dispose();
-      }
+    private async void DisposeMatlabConnector() {
+      UpdateStatus("Closing Matlab");
+      await Task.Run(() => {
+        if (_mlConnector != null) {
+          _mlConnector.Dispose();
+        }
+      });
     }
     #endregion
 
-    
+
 
     /// <summary>
@@ -115,7 +146,8 @@
     /// </summary>
     private async void GetVariableNamesAsync() {
+      UpdateStatus("Opening Matlab");
+
       var path = openFileDialog.FileName;
       ProblemTextBox.Text = path;
-      
       var variables = await Task.Run(() => {
         OpenMatlabConnector();
@@ -123,4 +155,5 @@
       });
 
+      UpdateStatus("Loading variable names");
       var variablesListBoxItems = VariablesListBox.Items;
       variablesListBoxItems.Clear();
@@ -128,4 +161,5 @@
         variablesListBoxItems.Add(item, false);
       }
+      UpdateStatus("Done");
     }
 
@@ -134,27 +168,23 @@
     /// </summary>
     private async void LoadValuesAsync() {
-      var values = new List<MLTimeseries>();
-      foreach (KeyValuePair<string, MLDatatype> item in VariablesListBox.CheckedItems) {
-        if (item.Value == MLDatatype.Timeseries) {
-          var val = _mlConnector.GetTimeseries(item.Key);
-          if (val != null) {
-            values.Add(val);
+      try {
+        PreviewDatasetMatrix.Content = new Dataset();
+
+        UpdateStatus("Loading values from Matlab");
+        var vals = await Task.Run<List<MLTimeseries>>(() => {
+          var values = new List<MLTimeseries>();
+          foreach (KeyValuePair<string, MLDatatype> item in VariablesListBox.CheckedItems) {
+            if (item.Value == MLDatatype.Timeseries) {
+              var val = _mlConnector.GetTimeseries(item.Key);
+              if (val != null) {
+                values.Add(val);
+              }
+            }
           }
-        }
-      }
-      
-      DisplayLoadedValuesAsync(await Task.Run<MLTimeseries>(() => new MLTimeseries(values)));
-    }
-
-    private async void DisplayLoadedValuesAsync(MLTimeseries timeseries) {
-      PreviewDatasetMatrix.Content = null;
-      try {
-
-        IEnumerable<string> variableNamesWithType = GetVariableNamesWithType(timeseries);
-        var values = await Task.Run<double[,]>(() => GetValuesForDataset(timeseries));
-        _values = new Dataset(variableNamesWithType, values);
-        PreviewDatasetMatrix.Content = _values;
-        SetPossibleTargetVariables(timeseries);
-
+          return values;
+        });
+
+        UpdateStatus("Converting values");
+        DisplayLoadedValuesAsync(await Task.Run<MLTimeseries>(() => new MLTimeseries(vals)));
         ErrorTextBox.Text = String.Empty;
         ErrorTextBox.Visible = false;
@@ -162,63 +192,73 @@
       } catch (Exception ex) {
         if (ex is IOException || ex is InvalidOperationException || ex is ArgumentException) {
-          OkButton.Enabled = false;
-          ErrorTextBox.Text = ex.Message;
-          ErrorTextBox.Visible = true;
+          ErrorOccured(ex.Message);
         } else {
           throw;
         }
       }
-    }
-
+      UpdateStatus("Done");
+    }
+
+    /// <summary>
+    /// Displays the values of a given timeseries at the preview dataset matrix.
+    /// </summary>
+    /// <param name="timeseries"></param>
+    private async void DisplayLoadedValuesAsync(MLTimeseries timeseries) {
+      PreviewDatasetMatrix.Content = null;
+      IEnumerable<string> variableNamesWithType = GetVariableNamesWithType(timeseries);
+      var values = await Task.Run<double[,]>(() => GetValuesForDataset(timeseries));
+      _values = new Dataset(variableNamesWithType, values);
+      PreviewDatasetMatrix.Content = _values;
+      SetPossibleTargetVariables(timeseries);
+    }
+
+    /// <summary>
+    /// Sets the entries of the combobox for the target variable.
+    /// </summary>
+    /// <param name="timeseries"></param>
     protected void SetPossibleTargetVariables(MLTimeseries timeseries) {
       if (timeseries != null) {
-
         TargetVariableComboBox.DataSource = timeseries.DataHeader;
       }
     }
 
+    /// <summary>
+    /// Returns a list with all selected variable names for the preview dataset.
+    /// </summary>
+    /// <param name="timeseries"></param>
+    /// <returns></returns>
     private IEnumerable<string> GetVariableNamesWithType(MLTimeseries timeseries) {
       IList<string> variableNamesWithType = timeseries.DataHeader.ToList();
       variableNamesWithType.Insert(0, "time");
-      /*for (int i = 0; i < variableNamesWithType.Count; i++) {
-        variableNamesWithType[i] += " (Double)";
-      }*/
-     
       return variableNamesWithType;
     }
-
-    private object locker = new object();
 
     /// <summary>
     /// Returns a two dimensional double array which contains the values including the timestamps of the given timeseries.
     /// Array[value, variable] 
+    /// If the amount of the data is too big, a OutOfMemoryException exception is being thrown. 
+    /// This exception is being cought and a message will be shown at the error message box.
     /// </summary>
     /// <param name="timeseries"></param>
     /// <returns></returns>
     private double[,] GetValuesForDataset(MLTimeseries timeseries) {
-      double[,] datasetValues = new double[timeseries.Count, timeseries.DataHeader.Length + 1];
-      var sortedValues = new SortedList<double, double[]>();
-      var times = timeseries.Times;
-      Parallel.For(0, datasetValues.GetLength(0), (idx) => { 
-        var time = times[idx];
-        var values = timeseries.GetValuesByTime(time);
-        lock(locker) {
-          sortedValues.Add(time, values);
-        }
-      });
-
-      int i = 0;
-      foreach (var item in sortedValues) {
-        datasetValues[i, 0] = item.Key;
-        for (int j = 1; j < datasetValues.GetLength(1); j++) {
-          datasetValues[i, j] = item.Value[j - 1];
-        }
-        i++;
-      }
-      return datasetValues;
-    }
-    
-
-
+      try {
+        double[,] datasetValues = new double[timeseries.Count, timeseries.DataHeader.Length + 1];
+
+        int i = 0;
+        foreach (var item in timeseries.Data) {
+          datasetValues[i, 0] = item.Key;
+          for (int j = 1; j < datasetValues.GetLength(1); j++) {
+            datasetValues[i, j] = item.Value[j - 1];
+          }
+          i++;
+        }
+        return datasetValues;
+      } catch (OutOfMemoryException ex) {
+        ErrorOccured(ex.Message + " Amount of the given data is too big.");
+      }
+      return new double[0, timeseries.DataHeader.Length + 1];
+    }
   }
 }
+
Index: branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/MatlabConnector.cs
===================================================================
--- branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/MatlabConnector.cs	(revision 15918)
+++ branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/MatlabConnector.cs	(revision 15919)
@@ -112,5 +112,5 @@
           matLabApi.GetWorkspaceData(varName, workspace, out value);
         }
-      } catch (COMException e) {
+      } catch (COMException) {
         throw new ArgumentException(string.Format("The variable {0} does not exist in the current workspace {1}.", varName, workspace));
       }
@@ -137,5 +137,5 @@
           matLabApi.Execute("exit");
         }
-      } catch (COMException e) {
+      } catch (COMException) {
       } finally {
         matLabApi = null;
Index: branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/IMLTimeseries.cs
===================================================================
--- branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/IMLTimeseries.cs	(revision 15918)
+++ branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/IMLTimeseries.cs	(revision 15919)
@@ -6,5 +6,5 @@
 
 namespace HeuristicLab.Problems.Instances.DataAnalysis.Regression.Matlab.Api.Types {
-    public interface IMLTimeseries {
+    public interface IMLTimeseries : IMLVariable {
         /// <summary>
         /// Data headers of the timeseries.
Index: branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/IMLValueVariable.cs
===================================================================
--- branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/IMLValueVariable.cs	(revision 15918)
+++ branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/IMLValueVariable.cs	(revision 15919)
@@ -6,10 +6,9 @@
 
 namespace HeuristicLab.Problems.Instances.DataAnalysis.Regression.Matlab.Api.Types {
-    public interface IMLValueVariable<TData> : IMLVariable<TData> {
-        /// <summary>
-        /// Converts a Matlab variable into a timeseries.
-        /// </summary>
-        /// <returns></returns>
-        IMLTimeseries ToTimeseries();
-    }
+  public interface IMLValueVariable<TData> : IMLVariable {   
+    /// <summary>
+    /// The data of the Matlab variable.
+    /// </summary>
+    TData Data { get; set; }
+  }
 }
Index: branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/IMLVariable.cs
===================================================================
--- branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/IMLVariable.cs	(revision 15918)
+++ branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/IMLVariable.cs	(revision 15919)
@@ -6,19 +6,14 @@
 
 namespace HeuristicLab.Problems.Instances.DataAnalysis.Regression.Matlab.Api.Types {
-    public interface IMLVariable<TData> {
-        /// <summary>
-        /// The name of the Matlab variable.
-        /// </summary>
-        string Name { get; set; }
+  public interface IMLVariable {
+    /// <summary>
+    /// The name of the Matlab variable.
+    /// </summary>
+    string Name { get; set; }
 
-        /// <summary>
-        /// The data of the Matlab variable.
-        /// </summary>
-        TData Data { get; set; }
-
-        /// <summary>
-        /// The Matlab datatype.
-        /// </summary>
-        MLDatatype Datatype { get; }
-    }
+    /// <summary>
+    /// The Matlab datatype.
+    /// </summary>
+    MLDatatype Datatype { get; }
+  }
 }
Index: branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/MLDouble.cs
===================================================================
--- branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/MLDouble.cs	(revision 15918)
+++ branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/MLDouble.cs	(revision 15919)
@@ -22,9 +22,5 @@
     public MLDatatype Datatype {
       get { return MLDatatype.Double; }
-    }
-
-    public IMLTimeseries ToTimeseries() {
-      return new MLTimeseries(Name, new double[,] { { 0 } }, new double[,] { { Data } });
-    }
+    }    
   }
 }
Index: branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/MLDoubleArray.cs
===================================================================
--- branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/MLDoubleArray.cs	(revision 15918)
+++ branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/MLDoubleArray.cs	(revision 15919)
@@ -7,4 +7,7 @@
 namespace HeuristicLab.Problems.Instances.DataAnalysis.Regression.Matlab.Api.Types {
   public class MLDoubleArray : IMLValueVariable<double[,]> {
+    private string[] _dataHeaders;
+
+    #region Constructors
 
     public MLDoubleArray(string name, object values) {
@@ -14,7 +17,65 @@
       }
       Data = values as double[,];
+
+      _dataHeaders = new string[Data.GetLength(1)];
+      for (int i = 0; i < _dataHeaders.Length; i++) {
+        _dataHeaders[i] = string.Format("{0}:{1}", name, i);
+      }
     }
 
+    private MLDoubleArray(MLDoubleArray a1, MLDoubleArray a2) {
+      Name = string.Format("{0};{1}", a1.Name, a2.Name);
+
+      if (!ConcatFeasible(a1, a2)) {
+        throw new ArgumentException(string.Format("Cannot concat {0} and {1}. Different number of rows.", a1.Name, a2.Name));
+      }
+
+      var numberOfColumns = a1.Columns + a2.Columns;
+      _dataHeaders = new string[numberOfColumns];
+      for (int i = 0; i < numberOfColumns; i++) {
+        if (i < a1.Columns) {
+          _dataHeaders[i] = a1.DataHeader[i];
+        } else {
+          _dataHeaders[i] = a2.DataHeader[i - a1.Columns];
+        }
+      }
+
+      Data = new double[a1.Rows, numberOfColumns];
+      for (int i = 0; i < a1.Rows; i++) {
+        for (int j = 0; j < numberOfColumns; j++) {
+          if (j < a1.Columns) {
+            Data[i, j] = a1.Data[i, j];
+          } else {
+            Data[i, j] = a1.Data[i, j - a1.Columns];
+          }
+        }
+      }
+    }
+    #endregion
+
+
+    /// <summary>
+    /// Concats two given MLDoubleArrays if their number of rows equals.
+    /// If they can't be concated, this method returns null.
+    /// </summary>
+    /// <param name="a1"></param>
+    /// <param name="a2"></param>
+    /// <returns></returns>
+    public static MLDoubleArray Concat(MLDoubleArray a1, MLDoubleArray a2) {
+      if (ConcatFeasible(a1, a2)) {
+        return null;
+      }
+      return new MLDoubleArray(a1, a2);
+    }
+
+    public static bool ConcatFeasible(MLDoubleArray a1, MLDoubleArray a2) {
+      return a1.Rows == a2.Rows;
+    }
+
+
+    #region Properties from the interface
+
     public string Name { get; set; }
+
     public double[,] Data { get; set; }
 
@@ -23,11 +84,18 @@
     }
 
-    public IMLTimeseries ToTimeseries() {
-      var times = new double[Data.GetLength(0), 1];
-      for (int i = 0; i < times.GetLength(0); i++) {
-        times[i, 1] = i;
+    public string[] DataHeader {
+      get { return _dataHeaders; }
+    }
+    #endregion
+
+    public int Rows { get {
+        return Data.GetLength(0);
       }
+    }
 
-      return new MLTimeseries(Name, times, Data);
+    public int Columns {
+      get {
+        return Data.GetLength(1);
+      }
     }
   }
Index: branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/MLTimeseries.cs
===================================================================
--- branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/MLTimeseries.cs	(revision 15918)
+++ branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Matlab/Api/Types/MLTimeseries.cs	(revision 15919)
@@ -11,4 +11,6 @@
 
     private string[] _dataHeaders;
+
+    #region Constructors
 
     protected MLTimeseries() {
@@ -35,12 +37,29 @@
         }
       }
+      
 
+      IList<MLTimeseries> tsCollection;
+      if (!(timeseries is IList<MLTimeseries>)) {
+        tsCollection = timeseries.ToList();
+      } else {
+        tsCollection = timeseries as IList<MLTimeseries>;
+      }
+
+      int[] indices = new int[tsCollection.Count];
       var numberOfElements = dataHeaders.Count;
-      Parallel.ForEach(times, (time) => {
-        //foreach (var time in times) {
+      foreach (var time in times) {
         var values = new double[numberOfElements];
         int idx = 0;
-        foreach (var item in timeseries) {
-          double[] vs = item.GetValuesByTime(time);
+        for (int i = 0; i < tsCollection.Count; i++) {
+          var item = tsCollection[i];
+          double[] vs;
+          if (indices[i] == 0 && item.Data[indices[i]].Key > time) {
+            vs = new double[item.Data[0].Value.Length];
+          } else {
+            if (indices[i] < item.Count - 1 && item.Data[indices[i] + 1].Key == time) {
+              indices[i]++;
+            }
+            vs = item.Data[indices[i]].Value;
+          }          
 
           foreach (var v in vs) {
@@ -48,9 +67,9 @@
           }
         }
+
         lock (_locker) {
           Data.Add(new KeyValuePair<double, double[]>(time, values));
         }
-      });
-
+      }
       _dataHeaders = dataHeaders.ToArray();
     }
@@ -96,4 +115,5 @@
       }
     }
+    #endregion
 
     public string Name { get; set; }
