Reputation: 1
I got a little problem in putting the code from matlab into python, i know how to make loops and stuff but the double equal sign is the same as function is member and I have no idea how to put it in python
for i=1:49
if path==var(path(1),i) == 0 & var(path(1),i) ~= 0
path(1,2) = var(r,i);
var2(i,1:2) = path;
path(1,1:2);
a = a+1;
two_connections(a,:) = path;
Upvotes: 0
Views: 299
Reputation: 30200
The double double equal sign in Matlab tests whether each value is equivalent.
In other words (a==b==c) will evaluate to 1 if a,b,c are equivalent, and 0 otherwise (even if a==b.)
It is sufficient to ensure that a==b and b==c (or a==b and a==c, etc.)
The tilde equals sign is simply "not equal to".
So your if statement would look like:
if (path == 0) and (var(path(1),i) == 0) and (var(path(1),i) != 0):
Upvotes: 1