Error using boxplot>straightenX
7 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Riya
on 12 Feb 2025 at 9:22
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!
0 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!