Error using boxchart on matrix data

I am trying to use boxchart() to plot a 3x44 double matrix in Matlab R2020b. Let's call my variable 'Y'. When I call boxchart(Y) I get the following error message:
% Error using boxchart (line 108)
% Data inputs must match the axis configuration. A numeric axis must have numeric data inputs or data inputs which can be converted to double.
Line 108 refers to this:
107 % Configure x-axis and convert xgroupdata to numeric
108 matlab.graphics.internal.configureAxes(cax,xgroupdata,ydata);
I get the same error message if I follow the tutorial here: openExample('graphics/CreateBoxChartsFromMatrixDataExample')
What may be the issue here?

4 comentarios

Cris LaPierre
Cris LaPierre el 6 de Mayo de 2021
Have you tried restarting MATLAB?
Yngve Bøe
Yngve Bøe el 6 de Mayo de 2021
I have not tried restarting, but upgrading to 2021a fixed it.
Thorsten Becker
Thorsten Becker el 25 de Ag. de 2021
i hvae the same issue. I run 2021a
Cris LaPierre
Cris LaPierre el 25 de Ag. de 2021
Please share your code and the complete error message (all the red text)

Iniciar sesión para comentar.

Respuestas (1)

Roelof du Plessis
Roelof du Plessis el 16 de En. de 2023

2 votos

First create a new empty figure before running boxchart. A previous figure with a "hold on" can cause this error.

2 comentarios

Daniel Song
Daniel Song el 27 de Oct. de 2023
I had a similiar issue. This fixes it, thanks
Cris LaPierre
Cris LaPierre el 27 de Oct. de 2023
As a best practice, always pair a 'hold on' with a 'hold off'

Iniciar sesión para comentar.

Categorías

Productos

Versión

R2020b

Etiquetas

Preguntada:

el 6 de Mayo de 2021

Comentada:

el 27 de Oct. de 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by