MATLAB: How to pass a variable into imadjust

imadjust()

Hi,
I wish to pass the contrast limits in the imadjust using a variable.
I tried in this way but it didn't work. I'll get a value for lower contrast limit using a input dialog box.
lowerContrast=str2num(answer{1});
lowContLimit=sprintf('%d',lowerContrast);
imgadj=imadjust(imgreen,[lowContLimit,1],[]);
but i am getting an error as
Function imadjust expected its second input argument, [LOW_IN; HIGH_IN] to be a two-element vector.
Can anyone help me.

Best Answer

Manoj - why are you creating a string as
lowContLimit=sprintf('%d',lowerContrast);
and trying to pass that into the imadjust function? Try instead
imgadj=imadjust(imgreen,[lowerContrast 1],[]);
where you are passing in the lower contrast as a number (with 1 as the upper bound on the interval).