Last change
on this file since 15958 was
15926,
checked in by rhanghof, 7 years ago
|
#2913:
- Added the support for importing different Matlab datatypes.
- Added some classes and changed the import dialog for importing double arrays.
|
File size:
1.5 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading;
|
---|
6 | using System.Threading.Tasks;
|
---|
7 | using System.Windows.Forms;
|
---|
8 | using HeuristicLab.Problems.DataAnalysis;
|
---|
9 | using HeuristicLab.Problems.Instances.DataAnalysis.Regression.Matlab.Api;
|
---|
10 | using HeuristicLab.Problems.Instances.DataAnalysis.Regression.Matlab.Api.Types;
|
---|
11 |
|
---|
12 | namespace HeuristicLab.Problems.Instances.DataAnalysis.Views.Regression.Matlab {
|
---|
13 | public partial class RegressionMatlabImportDialog {
|
---|
14 | private class MLDoubleArrayLoader : MLVariablesLoader {
|
---|
15 | public MLDoubleArrayLoader(RegressionMatlabImportDialog importDialog, CheckedListBox variablesListBox)
|
---|
16 | : base(importDialog, variablesListBox, MLDatatype.DoubleArray) {
|
---|
17 | }
|
---|
18 |
|
---|
19 | public override Dataset GetPreviewDataset(IMatlabConnector mlConnector, CancellationToken token) {
|
---|
20 | var doubleArrays = new List<MLDoubleArray>();
|
---|
21 |
|
---|
22 | foreach (MLVariableInfo item in _variablesListBox.CheckedItems.Cast< MLVariableInfo>().ToList()) {
|
---|
23 | if (token.IsCancellationRequested) {
|
---|
24 | return null;
|
---|
25 | }
|
---|
26 |
|
---|
27 | if (item.Datatype == _mlDatatype) {
|
---|
28 | var val = mlConnector.GetDoubleArray(item.VarName);
|
---|
29 | if (val != null) {
|
---|
30 | doubleArrays.Add(val);
|
---|
31 | }
|
---|
32 | }
|
---|
33 | }
|
---|
34 | var merged = MLDoubleArray.Concat(doubleArrays);
|
---|
35 | return new Dataset(merged.DataHeader, merged.Data);
|
---|
36 | }
|
---|
37 | }
|
---|
38 | }
|
---|
39 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.