Question: I have a vector like this:

> 
> a = [1 2 0 0 3 4 0 5]
> 
> 
> 

I wanna plot this vector but getting rid of the Os. So, I tried this:

```
> b = (a>0);
> c = a(b);
> plot(c);

```

The plot is just fine bit I'm not happy with the time axis. On the time axis, I have now consecutive steps; but I want it to be the corresponding time steps from `a` to the values `i` plot from `c`. So, in this case, my timeline should look like this:

```
> [1 2 5 6 8]

```

Any ideas?

Answer: 
Set the undesired values of `a` to `NaN`, and `plot` ignores them and interjects the line where `NaN` occurs. 

```
a(a==0)=NaN

```
`find()` does exactly what you want, return the index of every nonzero value.

```
a= [1 2 0 0 3 4 0 5];
b=find(a);
plot(b,a(b))

```

If you only want positive values, you also hook that into find:

```
b=find(a>0);

```