I have following problem:
I delete entries when in both matrices they are zero. If I have i pairs of such matrices, how to properly write indexing for the loop in matlab here?
code:
x = [0 0 0 1 1 0 5 0 7 0]
y = [0 2 0 1 1 2 5 2 7 0]
idx = ~(x==0 & y==0);
x2 = x(idx)
y2 = y(idx)
can you help me?
If I understand you correctly, you want to match elements where both x and y are zero, so something like this should work (without the not
~):Edit
Or more simply, as suggested by mutzmatron: