extract value of random matrix

Hello everyone,
I face a problem and I can not find a way to solve it. My problem is the following:
I simulate a geometric Brownian and an exponential barrier. I am looking to extract the time of contact between my fence and my Brownian. I manage to get a matrix that takes the value 0 if my Brownian is superior and the value of time otherwise. And I would like to extract each value that is after a 0 and a 0 before each value. [0 0 0 1 2 3 4 5 0 0 0 6 0] I would like to extract 1 5 and 6 On a path I can do it with "find" but the idea that I reply I do not see how.
if someone has an idea thank you.

Respuestas (1)

Image Analyst
Image Analyst el 21 de Mzo. de 2015

0 votos

Trivial if you have the Image Processing Toolbox - do you? Otherwise use abs(diff(vector))) with some other code to make sure you don't get uniform areas inside the non-zero areas.

2 comentarios

vachelard Valentin
vachelard Valentin el 21 de Mzo. de 2015
I don't have this toolbox :/
I will check that
thx!!
Image Analyst
Image Analyst el 21 de Mzo. de 2015
Too bad. Type "ver" on the command line to make sure you don't see it. Using diff() will be a lot more complicated if it's robust enough to handle all the strange cases you might encounter.

Iniciar sesión para comentar.

Categorías

Más información sobre Financial Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 21 de Mzo. de 2015

Comentada:

el 21 de Mzo. de 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by