Hi guys and thanks in advance. I have been trying to create boxplot for a matrix that is created after the result of series of computation. However when I do the boxplot command:
boxplot (x)
%The following error come up
Error using boxplot>straightenX (line 893)
'X' parameter must be a numeric vector or matrix.
Error in boxplot (line 273)
[xDat,gDat,origRow,xlen,gexplicit,origInd,origNumXCols] = straightenX(x,g);
I thought maybe if I rounded the value within the matrix it will be solved but when I do:
round(x,2)
%The following error came up
Error using sym/round
Too many input arguments.
So what is a good solution for this error in odrer to be able to get the boxplot for my matrix?

Réponses (1)

Riya
Riya le 12 Fév 2025

0 votes

Hi Abdullah,
I understand that you are encountering an error while trying to create a boxplot for a matrix. The main reason for this error is the use of symbolic variable “x” without proper conversion.
The “boxplot” function does not support symbolic variables and requires a numeric matrix as input. To solve the issue, you can convert the symbolic matrix “x” to a numeric matrix using the “double” function.
x_numeric = double(x);
boxplot(x_numeric);
This would fix the issue and the plot would be generated.
For more information about the “boxplot” function and its input arguments, please refer the following documentation:
Thanks!

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Produits

Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by