version: Matlab 2009a
I am generating a vector of size <1×116286> using randsrc() function. Since I am again adding it to the matrix of same size but of uint8 type, I am doing as follows –
l=typecast(randsrc(1,v(2)),'uint8');
Now, Matlab has changed the returned a vector of elements – [240,63,0] instead of [-1,1], with the size of <1×930288 uint8>. This is expected as double and uint8 has different size, but I want a vector of same size and values after type casting.
PS: I want to subtract or add ‘1’ from all trhe values on a matrix of size <1×116286>. Is there any other neat way to do this?
As I understand the problem, there are a couple of issues with the above:
Unfortunately I don’t have Matlab handy to test, but the following should provide something closer to what you are after: