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.
답변 (1개)
Image Analyst
2015년 3월 21일
0 개 추천
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
vachelard Valentin
2015년 3월 21일
Image Analyst
2015년 3월 21일
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.
카테고리
도움말 센터 및 File Exchange에서 Financial Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!