-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!)

4

1 回答 1

1

请参阅这一小段示例代码。

n = 10;
a = 2*rand(1,n) - 1; % some random data in [-1,1]
b = 255/2*(a+1); % linear projection to [0,255]
于 2015-08-25T02:43:17.843 回答