Azzera filtri
Azzera filtri

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

12 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

madhan ravi
madhan ravi il 27 Feb 2019
Modificato: madhan ravi il 27 Feb 2019
if ~rem(Var(i),1)
  5 Commenti

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by