Clear Filters
Clear Filters

How do I write an if statement for if a variable is an integer, perform a function.

12 views (last 30 days)
Please, how do I say this? I want to perform a function if Var(i) is an integer?
for i = 1: 1000
Var(i+1) = Var(i) + 100e-4
if Var(i) % condition for if Var(i) is an integer (whole number). How do I write this?
%Perform a function
end
end

Accepted Answer

madhan ravi
madhan ravi on 27 Feb 2019
Edited: madhan ravi on 27 Feb 2019
if ~rem(Var(i),1)
  5 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!