先定义函数文件bijiao.m
function [maxrgd,minrgd]=bijiao(rgd)
[m,n]=size(rgd);
maxrgd=rgd{1,1};minrgd=rgd{1,1};
for i=1:m
for j=1:n
if rgd{i,j}>maxrgd
maxrgd=rgd{i,j};
end
if rgd{i,j}<minrgd
minrgd=rgd{i,j};
end
end
end
maxrgd
minrgd
end
再调用函数:bijiao(rgd)