A=randi(10,[4 4]);
s=18;
W = bitshift(A,s-15,'int64')
Result:
W =
40 56 32 72
32 16 80 72
64 8 80 48
64 48 24 72
Documentation: If A is an array of signed integers, then bitshift returns the arithmetic shift results, preserving the signed bit when k is negative, and not preserving the signed bit when k is positive.
See simmilar question here
