function makeoval()
prompt = {'Enter width:', 'Enter height:', 'Enter radius:'};
dlgtitle = 'Input Variables';
dims = [1 35];
definput = {'', '', ''};
answer = inputdlg(prompt, dlgtitle, dims, definput);
width = str2double(answer{1});
height = str2double(answer{2});
radius = str2double(answer{3});
a = round(height/2);
b = round(width/2);
randmatrix = rand(height,width);
for r = 1:height
for c = 1:width
if (r-a).^2 + (c-b).^2 > radius^2
randmatrix(r,c) = 0;
end
end
end
imagesc(randmatrix);
end
function makeoval()
|
错误: 此上下文中不允许函数定义。