I have a matrix and vectors of noise onsets and correspondig offsets positions for each row in the matrix.
I need to replace all the cell values between onsets and offsets with NaN's. For example:
matrix =
29.6676 48.8609 67.9136 33.5357 89.0923 61.7666 97.8681 81.8149 43.2392 52.6876
31.8778 57.8525 39.5515 67.9728 33.4163 85.9442 71.2694 81.7547 82.5314 41.6799
42.4167 23.7284 36.7437 13.6553 69.8746 80.5489 50.0472 72.2440 8.3470 65.6860
50.7858 45.8849 98.7982 72.1227 19.7810 57.6722 47.1088 14.9865 13.3171 62.7973
onsets_row1 = [1 5]
offsets_row1 = [3 8]
new_matrix =
NaN NaN NaN 33.5357 NaN NaN NaN NaN 43.2392 52.6876
31.8778 57.8525 39.5515 67.9728 33.4163 85.9442 71.2694 81.7547 82.5314 41.6799
42.4167 23.7284 36.7437 13.6553 69.8746 80.5489 50.0472 72.2440 8.3470 65.6860
50.7858 45.8849 98.7982 72.1227 19.7810 57.6722 47.1088 14.9865 13.3171 62.7973
How do I replace all the values between onsets and offsets?
thnx
Best Answer