Info

This question is closed. Reopen it to edit or answer.

Want to create subclass of Dataset class in Stats Toolbox: Why does the variable editor view of my new class look so unexpected?

1 view (last 30 days)
I am trying to reate a sublcass of the Dataset Class in the Stats Toolbox. Specifically I am trying to create a class to reflect the data from a raman spectroscopy experiment.
I recently got some help (thank you very much to user OWR) with the constructor for this class but now I notice that the variable editor view of my ramandataset object looks like the following:
dataset|<1x1 dataset>|<1x1 dataset>| dataset|<1x1 dataset>|<1x1 dataset>|
rather than:
val =
sample1 sample2 2.3 2.4 4.5 4.1
etc...
Could someone shed some light on this behavior?
Thank you very much! Justin
classdef ramandataset < dataset
properties
ExperimentID
SampleID
ExciteWavelength
DateTaken
Apparatus
end
methods %TODO: Set it up to handle datasets that are not of equal length using NaN
function spec = ramandataset(varargin)
%RAMANDATASET Class Constuctor
% INPUT DATA: same way as if using the dataset class.
spec = spec@dataset(varargin{:});
end % END CONSTRUCTOR
end % END CONSTRUCTOR METHODS
methods
function modspec = plus(varargin)
%PLUS/RAMANDATASET
% Only 2 input arguments - First argument takes precedence, second
% argument can only have a single spectra in it.
modspec = varargin{1};
arg1 = varargin{1};
arg2 = varargin{2};
if nargin ==1
error('ERROR: Not enough Input for Plus Operator');
elseif nargin ==2
if strcmp(class(arg1),'ramandataset')&&strcmp(class(arg2),'dataset')
argument1 = double(varargin{1});
argument2 = double(varargin{2});
for j = 1:size(argument1,2)/2
for i = 1:size(argument1,1)
index = find(argument1(:,2*j-1)==argument2(i,1));
if ~isempty(index)
argument1(index,2*j) = argument1(index,2*j) + argument2(i,2);
end %END IF
end %END FOR
replacementdata = argument1(:,2*j-1:2*j);
names = get(arg1,'VarNames');
modspec = replacedata(modspec,replacementdata,char(names{j}));
end %END FOR
elseif strcmp(class(arg1),'ramandataset')&&strcmp(class(arg2),'double')
elseif strcmp(class(arg2),'ramandataset')&&strcmp(class(arg1),'double')
error('ERROR: First Argument in plus() must be ramandataset');
end %END IF
end %END IF
end %END OVERLOADED PLUS()
end % END OVERLOADING METHODS
end % END CLASSDEF
  1 Comment
Justin
Justin on 31 Aug 2011
Sorry the formatting of my question at the top got screwed up, basically the output of the variable editor lists each element of as a <1x1 dataset> rather than listing the actual value.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!