⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 run_draw.m

📁 matlab6.5图形图像处理源程序.很多的。很好用的。很有帮助的。
💻 M
字号:
function Run_Draw(Fig_UserData,isYnHold)
%创建一个函数对应绘图函数实现的功能
%Fig_UserData为输入参数,对应于Figure的属性'UserData'的值'
%isYnHold为hold on和hold off的判断位

if length(Fig_UserData)~=7
    ErrorDlg('输入参量不符合长度要求');
    return;
end;
%对输入参量进行长度检查
%下面对线性判断
switch Fig_UserData(2)
    case 1 
        str1='-';   %实线
    case 2 
        str1='--';  %双划线
    case 3 
        str1=':';   %虚线
    case 4 
        str1='-.';  %点划线
    otherwise 
        str1='-';%其它为实线
end
%下面对点型的判断
switch Fig_UserData(3)
    case 1  
        str2='';   %无点型
    case 2  
        str2='+';  %十字符
    case 3  
        str2='o';  %空心圆
    case 4  
        str2='*';  %星号
    case 5  
        str2='.';  %实心圆
    case 6  
        str2='x';  %叉符
    case 7  
        str2='s';  %正方符
    case 8  
        str2='d';  %菱形符
    case 9  
        str2='^';  %上三角符
    case 10 
        str2='v';  %下三角符
    case 11 
        str2='<';  %左三角符
    case 12 
        str2='>';  %右三角符
    case 13 
        str2='p';  %五星符
    case 14 
        str2='h'; %六星符
    otherwise 
        str2='';
end
%下面对颜色的判断
switch Fig_UserData(4)
    case 1 
        str3='k'; %黑色
    case 2 
        str3='r'; %红色
    case 3 
        str3='g'; %绿色
    case 4 
        str3='b'; %蓝色
    case 5 
        str3='c'; %青色
    case 6 
        str3='m'; %品红色
    case 7 
        str3='y'; %黄色
    case 8 
        str3='w'; %白色
    otherwise 
        str3='k';
end
str=strcat(str1,str2,str3);
% 连接成一个字符串
%下面对参量第一个元素值判断调用绘图函数
disp(isYnHold )
switch Fig_UserData(1)
    case 1  
            x=0:0.05:5;           
            y=sin(x.^2);          
            plot(x,y,str);%2D绘图函数
    case 2  
            x = logspace(-1,2);
            loglog(x,exp(x),str);
    case 3  
            semilogx([1:100],str);
    case 4  
            semilogy([1:100],str);
    case 5  
            cla
            if isYnHold 
                hold off
                set(findobj(gcf,'Tag','Checkbox3'),'Value',0);
                Fig_UserData(7)=0;
                set(gcf,'UserData',Fig_UserData);
            end             %判断是否hold on打开,打开就关闭功能
            t = 0:pi/50:10*pi;
            plot3(sin(t),cos(t),t,str);        
    case 6 
            cla
            if isYnHold 
                hold off
                set(findobj(gcf,'Tag','Checkbox3'),'Value',0);
                Fig_UserData(7)=0;
                set(gcf,'UserData',Fig_UserData);
            end
            mesh(peaks);
    case 7 
            cla
            if isYnHold 
                hold off
                set(findobj(gcf,'Tag','Checkbox3'),'Value',0);
                Fig_UserData(7)=0;
                set(gcf,'UserData',Fig_UserData);
            end
            surf(peaks);
    otherwise 
              x=0:0.05:5;           
              y=sin(x.^2);          
              plot(x,y,str);
end
%由于绘图时可能涉及坐标轴的设置
if  Fig_UserData(6) 
    axis on
else
    axis off
end
if  Fig_UserData(5) 
    grid on
else
    grid off
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -