Filter löschen
Filter löschen

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

12 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

madhan ravi
madhan ravi am 27 Feb. 2019
Bearbeitet: madhan ravi am 27 Feb. 2019
if ~rem(Var(i),1)
  5 Kommentare

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by