Reply by trungk46da October 23, 20062006-10-23
Ah! I thought that the origin is a color image. In this case, this
code maybe usefull :

% Normalize between 0 and 255 :
y = data - min(min(data));
z = y/max(max(y))*255;
s = uint8(z); % Change to integer unit
% Save :
imwrite(s,'test2.jpg','jpg')

Hope it work! ;)

--- In m..., "trafton_d" wrote:
>
> The rgb2gay function does not work. I get back an error that says:
> "??? Error using ==> rgb2gray>parse_inputs
> MAP must be a m x 3 array.
>
> Error in ==> rgb2gray at 35
> X = parse_inputs(varargin{:});
> "
> The thing i'm trying to convert is just a 200x200 matrix full of
> values between 5.5 and -4.9.
> thanks again.
> --- In m..., "trungk46da" wrote:
> >
> > Hi,
> > I'm not sure if there's an option like this for imwrite function. But
> > maybe you can use the function rgb2gray() to convert the image to
> > grayscale before exporting it.
> >
> > --- In m..., "trafton_d" wrote:
> > >
> > > Hi.
> > > I'm just starting to use matlab to make stimuli so this is a very
> > > basic question. I have used matlab to create a gaussian image
and now
> > > i want to export it. the progblem is that if i use the imwrite
> command:
> > > >>imwrite(ans, 'pic2.jpg');
> > > The resultant output is BW and i need it to be grayscale. How do i
> > > output in grayscale?
> > > thanks for the help.
> > > t
> > >
>
Reply by Emre ARDALI October 23, 20062006-10-23
Hi;
What do you mean with the gaussian image, i don't understant exactly anyway. But you may try to set colormap to grey.
Does it help?(If you can sent a piece of m code, may help more)
Regards
Reply by trafton_d October 20, 20062006-10-20
The rgb2gay function does not work. I get back an error that says:
"??? Error using ==> rgb2gray>parse_inputs
MAP must be a m x 3 array.

Error in ==> rgb2gray at 35
X = parse_inputs(varargin{:});
"
The thing i'm trying to convert is just a 200x200 matrix full of
values between 5.5 and -4.9.
thanks again.
--- In m..., "trungk46da" wrote:
>
> Hi,
> I'm not sure if there's an option like this for imwrite function. But
> maybe you can use the function rgb2gray() to convert the image to
> grayscale before exporting it.
>
> --- In m..., "trafton_d" wrote:
> >
> > Hi.
> > I'm just starting to use matlab to make stimuli so this is a very
> > basic question. I have used matlab to create a gaussian image and now
> > i want to export it. the progblem is that if i use the imwrite
command:
> > >>imwrite(ans, 'pic2.jpg');
> > The resultant output is BW and i need it to be grayscale. How do i
> > output in grayscale?
> > thanks for the help.
> > t
>
Reply by trungk46da October 20, 20062006-10-20
Hi,
I'm not sure if there's an option like this for imwrite function. But
maybe you can use the function rgb2gray() to convert the image to
grayscale before exporting it.

--- In m..., "trafton_d" wrote:
>
> Hi.
> I'm just starting to use matlab to make stimuli so this is a very
> basic question. I have used matlab to create a gaussian image and now
> i want to export it. the progblem is that if i use the imwrite command:
> >>imwrite(ans, 'pic2.jpg');
> The resultant output is BW and i need it to be grayscale. How do i
> output in grayscale?
> thanks for the help.
> t
>
Reply by trafton_d October 19, 20062006-10-19
Hi.
I'm just starting to use matlab to make stimuli so this is a very
basic question. I have used matlab to create a gaussian image and now
i want to export it. the progblem is that if i use the imwrite command:
>>imwrite(ans, 'pic2.jpg');
The resultant output is BW and i need it to be grayscale. How do i
output in grayscale?
thanks for the help.
t