Assigning a value to 0's
조회 수: 2 (최근 30일)
이전 댓글 표시
Hey
I have a ColumnA(108x1), this column has values when B(say) is ON. But non-zeros are present for only 104rows, 4rows are still zeros(the lousy data).
What I am trying to do is replace these 0's to a large value or NaN so that it doesn't affect my code later down. However, now Column A exists for Test 1, when B is ON. Also, I get a new ColumnA for Test 2 when B is OFF, where all rows are 0.
I was thinking of doing a cursory check for 0's at the beginning 5-10 rows and create a NewColumnA if the conditioned is satisfied. But wasn't sure how to complete it.
So, something like an "iszero" function for rows 1 to 10 should do it for a NewColumnA. Would "find", to find the number of 0's, do it?
댓글 수: 2
Image Analyst
2012년 4월 4일
So A is nonzero for B = ON or B = OFF, and A = 0 for B = lousy data. What are the ranges of B for the 3 cases: (1) ON, (2) OFF, and (3) lousy data?
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Testing Frameworks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!