필터 지우기
필터 지우기

How to get rid of zeros in data?

조회 수: 5 (최근 30일)
Kelsey
Kelsey 2014년 8월 8일
댓글: Kelsey 2014년 8월 8일
I am plotting Efficiency vs. Acceleration. The formula for Efficiency is only valid if the vehicle is accelerating. Therefore, when the vehicle has a constant speed or is decelerating, it appears that Matlab gives it a value of zero. How do I get rid of all of the values of zero at the bottom of my plot?? Thank you so much, in advance!
Also, note that I tried:
Conversion_Eff=Conversion_Eff(Conversion_Eff~=0);
Accel=Accel(Conversion_Eff~=0);
but for some reason, that changed my data...I'm not sure why, and I'm not sure what to do! Thank you so much for your help.

채택된 답변

Christopher Berry
Christopher Berry 2014년 8월 8일
I think you were on the right track with
Conversion_Eff=Conversion_Eff(Conversion_Eff~=0);
Accel=Accel(Conversion_Eff~=0);
But I would do this instead:
Index = [Conversion_Eff ~= 0];
Converserion_Eff = Conversion_Eff(Index);
Accel = Accel(Index);
Storing the index first is important, otherwise the 2nd comparison Conversion_Eff ~= 0 is with the already modified vector, Conversion_Eff which should not contain any 0 values.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by