I have 2 question: 1) find function can give the all n-th element (first or last) that meet a logical expression. i want only the second one, can i do it in one line. i need it for a for-loop, i want to start from the second one. now i do it by:
h = find(f==condition,2);
can we have a way to do it in 1 line (and not use variable h)?
2) i have a vector contain numbers, i want ignore all 0 and find the place of first one that change his sign from the previous ones.
for example, in array r=[0 0 -2 -3 0 0 4 0 5 -2], my result is the place of 4 (7th).
i use find and diff to find it but it give me 3 (the place in vector not include 0):
how can i find it?