% save curve1 in TRAINDIR under given filename
cd(TRAINDIR);

[FILENAME, PATHNAME] = uiputfile('*.mat', 'Save Curve');
if (~ischar(PATHNAME) & PATHNAME==0) | (~ischar(FILENAME) & FILENAME==0)
    % cancel pressed
    return;
end
pathfilename = strcat(PATHNAME, FILENAME);

if ~isempty(pathfilename)
    curve = curve1;
    save(pathfilename, 'curve');
end

% append filename to training set 
trainingSetStr = char(trainingSet);
trainingSetStr = strvcat(trainingSetStr, FILENAME);
trainingSet = cellstr(trainingSetStr);
save train.mat trainingSet;

cd ..