-1

I have some arrays of data in range [-1,1] and need to convert them to range [0,255] in Matlab. Either formula or code! (I checked Matlab functions but i could not find any function related to this conversion!)

dpmcmlxxvi
  • 1,292
  • 1
  • 9
  • 13
Araz
  • 3
  • 5

1 Answers1

1

See this small piece of exmaple code.

n = 10;
a = 2*rand(1,n) - 1; % some random data in [-1,1]
b = 255/2*(a+1); % linear projection to [0,255]
wsdzbm
  • 3,096
  • 3
  • 25
  • 28