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 CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by