Hi,
I have a 1×600 matrix called 'samples' containing numbers from 0 to 255. I want to add the number 255 to every element in the array that is less than 100. I also want to divide the matrix into two different matrices, one contains the elements 0 to 300 and the other one from 301 to 600. I am able to divide the matrix in 2, but when I add the value 255 to every element less than 100 it adds it to all the elements in the matrix. How can I fix my error? Thanks! The code I have so far is
%samples is a 1x600 matrix
frames = 300; on = wkeep(samples,frames,[frames+1 1]); off = wkeep(samples,frames,[1 1]); if any (on < 100) on_count = on + 255; end if any (off < 100) off_count = off +255 ; end
Best Answer