-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetDataset_data_ByMatrix.m
executable file
·39 lines (35 loc) · 1.16 KB
/
setDataset_data_ByMatrix.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% Set the data field of a datasets by a given matrix.
%
% Author: Maurice Hollmann
% Date : 08/10
%
% Description:
%
% [dataset] = setDataset_data_ByMatrix(dataset, matrix2D)
%
% This methods sets the data (2D or 4D) for the given dataset and checks the outcome.
%
% Parameters:
% dataset - the datset to set the data2D field
% dataMatrix - a 2D or 4D matrix containing the whole data (nmbFeatures x nmbSamples)
%
% Returns:
% dataset - the datset with included data2D
%
% Comments:
%
function [dataset] = setDataset_data_ByMatrix(dataset, dataMatrix)
if(~isfield(dataset, 'type'))
error('Given dataset has not defined the field "type" !');
end
if( ~exist('dataset','var') || ~exist('dataMatrix','var') )
error('Usage of setDataset_data_ByMatrix: [dataset] = setDataset_data_ByMatrix(dataset, dataMatrix)');
end
if(isempty(dataMatrix))
error('Given matrix2D is empty!');
end
dataset.data = dataMatrix;
if(~checkDataset(dataset))
disp('WARNING: setDataset_data_ByMatrix: In the current state the dataset is not suitable for further processing, please see messages before!');
end
end