how to replace zeros's with o.1 in the ouput?

조회 수: 1 (최근 30일)
raghavendra kandukuri
raghavendra kandukuri 2018년 9월 27일
댓글: Star Strider 2018년 9월 27일
I have a calculation, which will generate a output(Duration) in text file, in the generated output, it does generates lots of zeros which i want to replace them with 0.1, how do i do that? PFA.
for i = 2:holder
duration(i)=(fielddatatime(i)-fielddatatime(i-1));
if
%expected calculation
end
end

채택된 답변

Star Strider
Star Strider 2018년 9월 27일
Try this:
duration = randi([0 9], 1, 15) % Create Vector
duration(duration == 0) = 0.1
duration =
9 0 4 0 8 7 1 4
duration =
9 0.1 4 0.1 8 7 1 4
  댓글 수: 4
raghavendra kandukuri
raghavendra kandukuri 2018년 9월 27일
@star Strider, yup my bad, i was doing it in wrong way, Thank you for your help.
Star Strider
Star Strider 2018년 9월 27일
As always, my pleasure!
No worries — we are all learning here.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by