lundi 9 février 2015

if statement syntax Matlab

I'm trying to translate some Matlab code into Python. Unfortunately I don't have Matlab so I can't try out the syntax.


I'm confused about an if statement below



for i = 1:200
if mod(i,10) == 0
i
end


The for loop then carries on to calculate some values which depend on i. What does the if statement do?


Can I also ask what the difference between a sparse matrix and one made with zeros eg



A = sparse(n,m)
B = zeros(n,m)


Thanks!


Aucun commentaire:

Enregistrer un commentaire