I have generated a vector "SleepData" that creates a 7200x1 vector of random #s from 0-12. I want the vector sensor data to have the value 1 when SleepData > 4. I have been able to do this.
I need help to make it so that the value of 1 lasts for 300 more indicies following the each initiation of 1. How can I do this?
SENSOR = zeros(length(SleepData),1);
SENSOR(SleepData>=4) = 1;
2 Comments
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/634369-vector-manipulation-for-randomized-data#comment_1104664
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/634369-vector-manipulation-for-randomized-data#comment_1104664
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/634369-vector-manipulation-for-randomized-data#comment_1104699
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/634369-vector-manipulation-for-randomized-data#comment_1104699
Sign in to comment.