Removing zeros from workspace

7 ビュー (過去 30 日間)
Alfie Skehel
Alfie Skehel 2020 年 3 月 9 日
コメント済み: Ameer Hamza 2020 年 3 月 9 日
HI,
I have copied and pasted data from excel, each population has different number of readings and as a result the smaller populations are filled with zeros in the remaining cells.
thefore when i do a boxplot of the workspace it includes the zeros, I was wondering if there is a way of removing the zero values and still doing the boxplot
Thanks
  3 件のコメント
Alfie Skehel
Alfie Skehel 2020 年 3 月 9 日
Alfie Skehel
Alfie Skehel 2020 年 3 月 9 日
I just need them to not equal zero so be just empty cells if that is possible?
Thanks

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

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 3 月 9 日
If you are just making boxplot, setting them to nan will work.
A = ...; % suppose A is the name of your matrix
A(A==0) = nan;
boxplot(A);
  2 件のコメント
Alfie Skehel
Alfie Skehel 2020 年 3 月 9 日
Thats perfect! thanks very much
Ameer Hamza
Ameer Hamza 2020 年 3 月 9 日
Glad to help.

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

その他の回答 (1 件)

darova
darova 2020 年 3 月 9 日
Try
data(data==0) = [];

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by