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

📄 interactive.m

📁 天线设计方面的资料
💻 M
字号:
function Interactive(hObject,action,val)
%set(hObject,'WindowButtonUpFcn','set(gcbf,''WindowButtonMotionFcn'','' '')');
%Pointer = get(hObject,'PointerShapeCData');
handles = guidata(hObject);
if (gca == handles.antenna)
    set(hObject,'CurrentAxes',handles.axes1)
end
Hand = findobj(hObject,'Type','axes');
Hand(find(Hand==handles.antenna))=[]; %Deleting the handles of the antenna
nAxes = size(Hand,1);
Graphs = 1:nAxes;
% Maximum number of axes we will ever have is 6
AxHand = {'handles.axes1','handles.axes2','handles.axes3',...
    'handles.axes4','handles.axes5','handles.axes6'};
AxHand = AxHand(1:nAxes); % Truncate new number of axes

% Rearange axes handles in order
for i=1:nAxes
    Hand(i) = eval(AxHand{i});
end

% Find the current axes
AxNum = find((gca(hObject)==Hand)==1);  
% if isempty(AxNum)
%     AxNum = 1;
%     set(hObject,'CurrentAxes',handles.axes1)
% end

% Find all other axes
Graphs(AxNum)=[];
AxHand{AxNum};
AxHand(AxNum)=[];
CurrentAxes = Hand(AxNum);
Hand(AxNum)=[];

X = zeros(1,nAxes); Y = X;
% Alter the crosshair for the active axes
[Tx,Ty] = crosshair(action);
s = sprintf('%3.3e',Tx);
Tx = str2num(s);
X(AxNum) = Tx;
Y(AxNum) = Ty;

% Find the dependend axes. Axes are assumed to be related by axes labels'
% -> Find the relevant axes (by label), and update relevant parameters
xAxis = get(get(gca,'xlabel'),'String');
yAxis = get(get(gca,'ylabel'),'String');

NotSet = [];
for i=1:(nAxes-1)
    XLabel = get(get(Hand(i),'xlabel'),'String');
    YLabel = get(get(Hand(i),'ylabel'),'String');
    set(hObject,'CurrentAxes',Hand(i))
    if strcmp(xAxis,XLabel)
        [X(Graphs(i)),Y(Graphs(i))] = crosshair('setx',Tx);
    elseif strcmp(xAxis,YLabel)
        [X(Graphs(i)),Y(Graphs(i))] = crosshair('sety',Tx);
    elseif strcmp(yAxis,XLabel)
        [X(Graphs(i)),Y(Graphs(i))] = crosshair('setx',Ty);
    elseif strcmp(yAxis,YLabel)
        [X(Graphs(i)),Y(Graphs(i))] = crosshair('sety',Ty);
    else
       NotSet = [NotSet Graphs(i)];
    end
end

if ~(isempty(NotSet))
    if NotSet(1) == Graphs(nAxes-1)
         Active = 'i';
         Set = 'j';
    else
        Active = 'j';
        Set = 'i';
    end
    for i=(nAxes-2):-1:1
        xAxis = get(get(Hand(i),'xlabel'),'String');
        yAxis = get(get(Hand(i),'ylabel'),'String');
        for j=(nAxes-1):-1:(i+1)
            XLabel = get(get(Hand(j),'xlabel'),'String');
            YLabel = get(get(Hand(j),'ylabel'),'String');
            set(gcf,'CurrentAxes',Hand(eval(Set)));
            if strcmp(xAxis,XLabel)
                [X(Graphs(eval(Set))),Y(Graphs(eval(Set)))] = crosshair('setx',eval(strcat('X(Graphs(',Active,'))')));
            elseif strcmp(xAxis,YLabel)
                [X(Graphs(eval(Set))),Y(Graphs(eval(Set)))] = crosshair('sety',eval(strcat('X(Graphs(',Active,'))')));
            elseif strcmp(yAxis,XLabel)
                [X(Graphs(eval(Set))),Y(Graphs(eval(Set)))] = crosshair('setx',eval(strcat('Y(Graphs(',Active,'))')));
            elseif strcmp(yAxis,YLabel)
                  [X(Graphs(eval(Set))),Y(Graphs(eval(Set)))] = crosshair('sety',eval(strcat('Y(Graphs(',Active,'))')));
            end
        end
    end
end
       
AntennaSelect = get(handles.AntennaSelect,'String');
AntennaValue = get(handles.AntennaSelect,'Value');
feval(strcat(AntennaSelect{AntennaValue},'SetParameters'),handles,X,Y);

% If FullScreenEdit exists, update it
FullScreenEdit = findobj('Tag','FullScreenEdit');
if ~isempty(FullScreenEdit)
   MirrorAxes = findobj(FullScreenEdit,'Type','Axes');
   cla(MirrorAxes);
   Traces = copyobj(get(CurrentAxes,'Children'),MirrorAxes);
   set(MirrorAxes,'XLim',get(CurrentAxes,'XLim'));
   set(MirrorAxes,'YLim',get(CurrentAxes,'YLim'));
   xlabel(MirrorAxes,get(get(CurrentAxes,'XLabel'),'String'));
   ylabel(MirrorAxes,get(get(CurrentAxes,'XLabel'),'String'));
end

feval(strcat(AntennaSelect{AntennaValue},'Draw'),handles);

set(hObject,'CurrentAxes',CurrentAxes);

⌨️ 快捷键说明

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