0001 function multiPlotParms(CV,otherfields,x,multicurve,multiplot)
0002
0003
0004
0005
0006 names = {CV.cvresultsNames{:} 'Val RMSE'};
0007 nreps = CV.validate.repetitions;
0008 resultsmat = CV.cvresults(:,1:end-nreps);
0009 z=CV.cvresults(:,end-nreps+1:end);
0010 resultsmat = [resultsmat mean(CV.cvresults(:,end-nreps+1:end),2)];
0011
0012 submat = resultsmat;
0013
0014 for i = 1:2:length(otherfields)
0015 f = char(otherfields{i});
0016 v = otherfields{i+1};
0017 c = whichColumn(names,f);
0018 submat = submat(submat(:,c)==v,:);
0019 end
0020
0021 if nargin == 5
0022 multiplotcol = whichColumn(names,multiplot);
0023 multiplotvalues = unique(submat(:,multiplotcol));
0024 nplots = length(multiplotvalues)
0025 sqrtnplots = ceil(sqrt(nplots));
0026 else
0027 sqrtnplots = 1;
0028 nplots = 1;
0029 end
0030
0031 if nargin > 3
0032 multicurvecol = whichColumn(names,multicurve);
0033 else
0034 multicurvecol = 0;
0035 end
0036
0037 xcol = whichColumn(names,x);
0038
0039 for ip=1:nplots
0040 subplot(sqrtnplots,sqrtnplots,ip);
0041
0042 if nplots > 1
0043 oneplotmat = submat(submat(:,multiplotcol)==multiplotvalues(ip),:);
0044 else
0045 oneplotmat = submat;
0046 end
0047
0048 if multicurvecol > 0
0049 multicurvevalues = unique(oneplotmat(:,multicurvecol));
0050 ncurves = length(multicurvevalues);
0051 else
0052 ncurves = 1;
0053 end
0054 data = {};
0055 lastxvalues = [];
0056 legendText = {};
0057 for ic = 1:ncurves
0058 if multicurvecol > 0
0059 onecurve = oneplotmat(oneplotmat(:,multicurvecol) == ...
0060 multicurvevalues(ic),:);
0061 else
0062 onecurve = oneplotmat;
0063 end
0064 xvalues = unique(onecurve(:,xcol));
0065 if ~isempty(lastxvalues) && ~all(xvalues == lastxvalues)
0066 error('multiPlotParms: x values not same in multiple curves');
0067 end
0068 [junk,indices] = sort(onecurve(:,xcol));
0069 onecurve = onecurve(indices,:);
0070 data = {data{:} onecurve(:,[xcol end])};
0071 if multicurvecol > 0
0072 legendText = {legendText{:} [num2str(multicurvevalues(ic)) ' ' ...
0073 multicurve]};
0074 end
0075 end
0076
0077 xs = [];
0078 for i = 1:length(data)
0079 plot(data{i}(:,1),data{i}(:,2));
0080 xs = [xs; data{i}(:,1)];
0081 hold on;
0082 end
0083 hold off;
0084 xlabel(x);
0085
0086 if nplots > 1
0087 title([multiplot ' ' num2str(multiplotvalues(ip))]);
0088 end
0089
0090 end
0091
0092
0093
0094
0095 function col = whichColumn(names,field)
0096 col = 0;
0097 for i=1:length(names)
0098 if strcmp(names{i},field)
0099 col = i;
0100 end
0101 end
0102