code not working in function but working in command line line by line
显示 更早的评论
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?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Images 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!