Error using boxplot>straightenX

1 次查看(过去 30 天)
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?

回答(1 个)

Riya
Riya 2025-2-12
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!

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by