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

📄 multipletrace.m

📁 天线设计方面的资料
💻 M
字号:
function MultipleTrace(hObject,handles)
% It is assumed that multiple traces (curves) are defined for all
% graphs if they exist. 
% This function determines if the multiple trace selection panel should be
% displayed

set(hObject,'CurrentAxes',handles.axes1)
H.axis = gca;
H.gui = handles;

% Get Line Data from Plot
% Lines are referenced as axis children, among other
% axis children; so first get all axis children
sibs = get(H.axis,'Children');

% Now search axis children for any line types.
% Because the columns of the y data matrix in a plot
% command seem to be reversed in the axis children, 
% count down from max sibs to the first sib.
lines = 0;
H.data.xdata = [];
H.data.ydata = [];
H.data.xpoint = [];
H.data.ypoint = [];
H.data.xindex = 1;
H.data.yindex = 1;
i = max(size(sibs));
while i >= 1
    if strcmp(get(sibs(i),'Type'),'line')

        % OK, found a line among the axis children.
        lines = lines + 1;

        % put line data into a column of DATA.xdata|DATA.ydata
        H.data.xdata(:,lines) = get(sibs(i),'XData').';
        H.data.ydata(:,lines) = get(sibs(i),'YData').';
    end
    i = i - 1;
end

% 'traces' string variable must be in ascending order
% Trace Label can and should be changed
traces  = '';
i = 1;
while i <= lines;
    Tag = get(sibs(lines-i+1),'Tag');
    if isempty(Tag)
        Tag = strcat('Trace',num2str(i));
    end
    if i < lines
        tracelabel = strcat(Tag,'|');         % sprintf('Column %4d|',i);     % Change Labels     
    else
        tracelabel = Tag;                   % sprintf('Column %4d',i);      % Change Labels
    end
    traces = strcat(traces,tracelabel);
    i = i + 1;
end

% If more than one line, display GUI for line selection

% Switch off||on Trace Selection GUI
Vis = 'Off';
if lines > 1,
    Vis = 'On';
elseif lines == 0
    error('No lines found in the current plot window\n');
end
set(H.gui.TracePanel,'Visible',Vis);
set(H.gui.TraceSwitch,'String',traces);
set(H.gui.TraceSwitch,'Value',1);

⌨️ 快捷键说明

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