code not working in function but working in command line line by line
Show older comments
i am writing a matlab function to produce a matching gray scale image. code is working in command line when i run it line by line but not running as a function and giving errors
too many input arguments
Error in imagesc (line 18)
hh =
image(varargin{1},'CDataMapping','scaled');
Error in image (line 19)
imagesc(j);
i am new to matlab and unable to understand.
function code is:
function image(grayLevel)
I = [255,255,0,0;255,255,0,0;0,0,255,255;0,0,255,255];
j = repmat(I,64);
i = 16;
m = 32;
while (i<256)
while(i<=m)
for k = 1:256
j(i,k) = grayLevel;
end
i = i+1;
end
i = i +16;
m = i+16;
end
imagesc(j);
end
any help or suggestions?
Accepted Answer
More Answers (0)
Categories
Find more on Images in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!