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

📄 tzoom.m

📁 generate eye diagram from spice sim result
💻 M
📖 第 1 页 / 共 2 页
字号:
                old_num_test=old_num_last;                  %valid number before the ":"
            else 
                old_num_test=0;                             %not a valid number, flag to fail the old_num_test
            end;
                
            if old_num_test==old_fig; % this indicates that the old figure has the form "x: figure name"
                new_fig_name=[old_num '/' num2str(new_fig) old_name];
            else
                new_fig_name=[num2str(old_fig) '/' num2str(new_fig) ': ' old_fig_name];
            end;
        end;
        
        set(new_fig,'Name',new_fig_name);       %set the figure name
		set(new_fig,'NumberTitle','off');       %turn off the default figure title, i.e. don't show "Figure No. "
        subplot_i=0;                            %zero the subplot index
        subplot_n=length(h_axes);               %number of subplots in the figure
        %Consruct the subplots
        for hai = fliplr(h_axes);               %the transpose is added to make it a one row and hence go through the indices of h_axes, flip left-2-righ to start with the upper axes first
        subplot_i=subplot_i+1;  
            figure(new_fig);                    %focus on the new figure
    		ha_sub=subplot(subplot_n,1,subplot_i);
    		hl_sub=plot([0 0]);
            hli=get(hai,'Children');            %get the handle of line in the current axis
    		ydata=get(hli,'YData');y_label=get(hai,'YLabel');
            h_y_label=get(hai,'YLabel');y_label=get(h_y_label,'String');
            set(hl_sub,'XData',xdata(x1_index:x2_index),'YData',ydata(x1_index:x2_index));
            xlim(ha_sub,xx);                    %change the limits
            ylabel(y_label);
            grid on;
		end
        h_x_label=get(h_axes(1),'XLabel');x_label=get(h_x_label,'String'); xlabel(x_label);     %label the x-axis with the xlabel of the bottom axes
        tzoom gui;
%--------------------------------------------------------------------------    
    case 'marker',
        for hai = h_axes;
            hli=get(hai,'Children'); %get the handle of line in the current axis
            m_old=get(hli,'Marker');
            switch m_old
                case 'none',
                    set(hli,'Marker','o')
                case 'o',
                    set(hli,'Marker','none')
            end;
        end
%--------------------------------------------------------------------------
    case 'pointer',
        pointer = get(hf,'pointer');
        switch pointer
            case 'arrow',
                   set(hf,'pointer','fullcrosshair');
            case 'fullcrosshair',
                   set(hf,'pointer','arrow');
        end
%--------------------------------------------------------------------------                
    case 'gui'
		% Construct GUI
		buttonx      = .89;
		buttonwidth=0.11;
		buttonheight= 0.05;
		spacing=.9;
		hb=gcf;
		pq = uicontrol(hb   ,...                 % Time Zoom Button
             'Style'          , 'pushbutton',...
             'Units'          , 'normalized',...
             'String'         , 'Zoom-Time',...
             'Position'       , [buttonx, 0.05+spacing,buttonwidth,buttonheight],...
             'Callback'       ,'tzoom zoom');
         
		pq = uicontrol(hb   ,...                 % Time Un-Zoom Button
             'Style'          , 'pushbutton',...
             'Units'          , 'normalized',...
             'String'         , 'UnZoom-Time',...
             'Position'       , [.8, 0.05+.9,.11,.05],...
             'Callback'       ,'tzoom unzoom');

		pq = uicontrol(hb   ,...                 % Full Time Button
             'Style'          , 'pushbutton',...
             'Units'          , 'normalized',...
             'String'         , 'Full-Time',...
             'Position'       , [.67, 0.05+.9,.11,.05],...
             'Callback'       ,'tzoom full');         

         pq = uicontrol(hb   ,...                 % Set time-limits Button
             'Style'          , 'pushbutton',...
             'Units'          , 'normalized',...
             'String'         , 'Set Time Scale',...
             'Position'       , [.57, 0.05+.9,.11,.05],...
             'Callback'       ,'tzoom limits');
		         
		pq = uicontrol(hb   ,...                 % crop Button
             'Style'          , 'pushbutton',...
             'Units'          , 'normalized',...
             'String'         , 'Crop Time Scale',...
             'Position'       , [.45, 0.05+.9,.11,.05],...
             'Callback'       ,'tzoom crop');
		
         pq = uicontrol(hb   ,...                 % crop_newfig Button
             'Style'          , 'pushbutton',...
             'Units'          , 'normalized',...
             'String'         , 'Crop to NewFig',...
             'Position'       , [.35, 0.05+.9,.11,.05],...
             'Callback'       ,'tzoom cropnew');
         
		pq = uicontrol(hb   ,...                 % Toggle Marker Button
             'Style'          , 'pushbutton',...
             'Units'          , 'normalized',...
             'String'         , 'Toggle Marker',...
             'Position'       , [.23, 0.05+.9,.11,.05],...
             'Callback'       ,'tzoom marker');
         
		pq = uicontrol(hb   ,...                 % Toggle Pointer Button
             'Style'          , 'pushbutton',...
             'Units'          , 'normalized',...
             'String'         , 'Toggle Pointer',...
             'Position'       , [.13, 0.05+.9,.11,.05],...
             'Callback'       ,'tzoom pointer');
         
        pq = uicontrol(hb   ,...                 % remove GUI Button
             'Style'          , 'pushbutton',...
             'Units'          , 'normalized',...
             'String'         , 'Remove Buttons',...
             'Position'       , [0, 0.05+.9,.11,.05],...
             'Callback'       ,'tzoom remove');
%--------------------------------------------------------------------------                
    case 'remove'
        h_uic=findobj(hf,'Type','uicontrol')';
        delete(h_uic);
%--------------------------------------------------------------------------   
    otherwise,  %if the input to the function is unknown then just break 
        return;
    
end     %end of switch statment
%--------------------------------------------------------------------------

function two_points=ginput2()
    [x,y,button]=ginput(2);                     %get the two time points from the figure using the mouse
    if sum(button==1)~=2;x=[0 0];end;           %if the buttons pressed are not both the left buttons, flag to do nothing
    two_points=[min(x) max(x)];                 %order the two points

⌨️ 快捷键说明

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