%SPECTROMETER Part of the IRAS Low Resolution Spectrometer Database
%PRTools UCI dataset import, 531 objects, 101 integer features, 10 classes
%
% A = SPECTROMETER
%
%DESCRIPTION
%This command downloads one of the UCI data sets, converts it into PRTools
%format and stores it locally for future use. Consult the related website
%for further information. Please make the appropriate references in
%publications that make use of this dataset.
%
%Refer to the dataset documentation before using this routine. The
%attributes 1 and 2 are removed (LRS name and LRS class). Consequently
%featues 1-8 contain header information, feature 9-52 the blue band and
%feature 53-101 the red band.
%
%Just the basic classes are used as class labels (floor of attribute_2/10).
%There are five classes with a very few objects (1 2 6 7 and 6 objects).
%Remove them by A = REMCLASS(A,N) with, e.g., N = 7.
%
%SEE ALSO PRTools Guide, UCI Website
%PRTOOLS, DATASETS, REMCLASS
% Copyright: R.P.W. Duin, r.p.w.duin@37steps.com
function a = spectrometer
a = pr_download_uci('Low+Resolution+Spectrometer','lrs.data');
if size(a,1) ~= 531
% no proper mat-file yet, construct it from irregular dat-file
userdata = getuser(a,'data');
fid = fopen(pr_datfiles);
s = fread(fid);
s([s==40 | s==41 | s==10]) = [];
t = textscan(char(s'),['%s' repmat('%n',1,102)]);
a = prdataset([t{3:end}],ceil(t{2}/10));
a = setname(a,'Low Resolution Spectrometer');
a = setuser(a,userdata,'data');
pr_savematfile(a);
fclose(fid);
end