Trying to complete a boxplot for the Z values of a matrix

6 ビュー (過去 30 日間)
Todd Pierce
Todd Pierce 2022 年 4 月 25 日
編集済み: Cris LaPierre 2022 年 4 月 26 日
I am trying to make a boxplot of the data in a matrix of size [925x902] so i dont want the boxplot to make multiple plots of each column/row and instead one single plot of all the data within the matrix
the matrix is called D and i have the statistical package install on MATLAB version R2021a
Any way t plot this as simple boxplot(D) does not work and error messages come up;
Integers can only be combined with integers of the same class, or scalar doubles.
Any ideas

採用された回答

Cris LaPierre
Cris LaPierre 2022 年 4 月 25 日
MATLAB will treat each column as a separate data series.
A = rand(10,5);
boxchart(A)
If you want to only have a single boxplot containing all the data, use the colon operator to turn your matrix data into a vector.
figure
boxchart(A(:))
By the way, I'm using boxchart here, which is in base MATLAB, as opposed to boxplot, which requires the Statistics and Machine Learning toolbox. This approach will work with either.
  7 件のコメント
Cris LaPierre
Cris LaPierre 2022 年 4 月 25 日
編集済み: Cris LaPierre 2022 年 4 月 26 日
However you extracted A is probably the same thing you need to do to fix the error you are seeing.
load A.mat
boxplot(A(:))
figure
boxchart(A(:))
Todd Pierce
Todd Pierce 2022 年 4 月 25 日
Thank you this works smoothly now

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by