Hi, I really don´t have any idea how to do this..... I have a vector
a=[0.6 0.7 1.1 2.1 2.2 ....]
I want to convert it to this
b=[0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 ......]
Sampling frequency in this example is 0.1. I am sure there is a really easy way to do this but I can´t think of anything useful.
Thanks for the help,
Roberto

댓글 수: 1

Roberto De
Roberto De 2018년 7월 18일
Ok sorry, the 1s are indexed by a. For this reason 1 is in position 6,7,11,21 and 22 in vector b. I hope it is clearer now.

댓글을 달려면 로그인하십시오.

 채택된 답변

Guillaume
Guillaume 2018년 7월 18일

0 개 추천

b = [];
b(round(a/0.1)) = 1
The round is necessary because of floating point precision.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2018년 7월 18일

댓글:

2018년 7월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by