Want to create subclass of Dataset class in Stats Toolbox: How do I pass arguments to dataset constructor in constructor for new class?
Afficher commentaires plus anciens
How to I pass arguments to the constructor spec = spec@dataset(input); I want to have the full range of input options available to the normal dataset class. That is multiple inputs of the form: DS = DATASET(..., {DATA,'name'}, ...)
Should I be trying to create a string for the input argument and passing it using the EVAL(s) function?
classdef ramandataset < dataset
properties
ExperimentID
SampleID
ExciteWavelength
DateTaken
Apparatus
end
methods
function spec = ramandataset(data,names)
%RAMANDATASET Class Constuctor
% INPUT DATA: spec = ramandataset(data,names);
% where data is a double matrix of the form
% **********
% k ri k ri k ri
% **********
% and names is a 1 by n cell array of strings
if nargin == 0
super_args{1} = [0];
super_args{2} = '';
else
for i=1:size(data,2)/2
input = [];
super_args{1} = data(:,2*i-1:2*i);
super_args{2} = names{i};
input = {input super_args};
end %END FOR
end %END IF
spec = spec@dataset(input); %MY PROBLEM IS IN THIS LINE I THINK
end % END CONSTRUCTOR
end % END METHODS
methods
% % OVERLOADING
end
end % END CLASSDEF
Any advice would be most appreciated.
1 commentaire
Justin
le 30 Août 2011
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Construct and Work with Object Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!