IoSR-Surrey / MatlabToolbox

General purpose Matlab toolbox
MIT License
126 stars 43 forks source link

Error using iosr.statistics.boxPlot #7

Closed dumbly closed 7 years ago

dumbly commented 7 years ago

The follow code works:

figure;
tempNames = {'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K'};
tempData = randi([-250 -150],2,11,2);
tempData(:,1,1) = [-250 -251];
tempLabels = {'X' 'Y'};

iosr.statistics.boxPlot(tempNames...
    ,tempData,...
    'style','hierarchy',...
    'xSeparator',true,...
    'showScatter',true,...
    'scatterColor',[1 0 0],...
    'scatterMarker','*',...
    'groupLabels',groupLabels ...
    );

But when changing the 4th line to: tempData(:,1,1) = [-250 -250]; Gives the following error:

Error using griddedInterpolant
Interpolation requires at least two sample points in each dimension.
Error in interp1 (line 132)
    F = griddedInterpolant(X,V(:,1),method);
Error in iosr.statistics.boxPlot/xOffset (line 2348)
            maxDisplacement = interp1(xd, d, y);
Error in iosr.statistics.boxPlot/drawScatter (line 1607)
                xScatter = X + (0.8.*halfboxwidth.*obj.xOffset(Y));
Error in iosr.statistics.boxPlot/draw (line 1355)
                        obj.drawScatter(subidx,gidx,subidxAll);
Error in iosr.statistics.boxPlot (line 645)
                obj.draw('all');
Error in Example_iosr_boxplot_error (line 7)
iosr.statistics.boxPlot(tempNames... 

Example_iosr_boxplot_error.zip

See attachment for example code.