why this code not displaying else part

1 view (last 30 days)
the following code is only displaying the if part even if the value is less than 0.6
y = sprintf('%.1f',rand(1))
if y>0.6
disp('the value is false')
else
disp('true')
end

Accepted Answer

madhan ravi
madhan ravi on 7 Jun 2020
Remove sprintf()
  13 Comments
abdul rehman
abdul rehman on 7 Jun 2020
thanks Steven this was the actural issue. and sorry madhan

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!