# How to save matrix to workspace instead of plotting using imagesc function

3 views (last 30 days)

Show older comments

##### 0 Comments

### Accepted Answer

Walter Roberson
on 25 Jun 2012

If M is your image, then

minM = min(M(:));

maxM = max(M(:));

scaledM = (M - minM) ./ (maxM - minM);

This will be in the range 0 to 1, so if you want to work with uint8 then uint8(scaledM .* 255)

##### 8 Comments

### More Answers (0)

### See Also

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!