bastibe / Violinplot-Matlab

Violin Plots for Matlab
https://mathworks.com/matlabcentral/fileexchange/170126-violinplot-matlab
BSD 3-Clause "New" or "Revised" License
251 stars 105 forks source link

Error with structure input format #48

Closed OmarKhater-sws closed 2 years ago

OmarKhater-sws commented 2 years ago

I have data of the form: data = struct('Group1', rand(10,1), 'Group2', rand(20,1)); I see it should plot them field by field. However, it seems like there is something wrong with the input validation (function results = checkInputs(~, data, pos, varargin)). More specifically, parsing this line raises an error

p.addRequired('Data', @(x)isnumeric(vertcat(x{:})));

It is not clear for me why you do cell indexing while you accept the input in matrix format.

mikelgg93 commented 2 years ago

It will be fixed in the next commit, the error was on the violinplot.m function.

Line 135 should be violins(n) = Violin({thisData}, n, varargin{:}); instead it was violins(n) = Violin(thisData, n, varargin{:});.

Thanks for pointing this out.