📄 helicalinteractive.m
字号:
function HelicalInteractive(hObject,action,val)
handles = guidata(hObject);
if (gca == handles.antenna)
set(hObject,'CurrentAxes',handles.axes1)
end
Hand = findobj(hObject,'Type','axes');
Hand(find(Hand==handles.antenna))=[]; % Don't want handle to 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);
% 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);
% Find all other axes
Graphs(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('%2.2f',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');
load 'HelicalParameters';
% Redraw Figure 3, according to eqn
if AxNum~=3
[X,Y] = RedrawFig3(hObject,handles,BW,Pitch,X,Y,AxNum);
end
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
if AxNum==3
[X,Y] = RedrawFig3(hObject,handles,BW,Pitch,X,Y,AxNum);
end
AntennaSelect = get(handles.AntennaSelect,'String');
AntennaValue = get(handles.AntennaSelect,'Value');
feval(strcat(AntennaSelect{AntennaValue},'SetParameters'),handles,X,Y);
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(gcf,'CurrentAxes',CurrentAxes);
function [X,Y] = RedrawFig3(hObject,handles,BW,Pitch,X,Y,AxNum);
if get(handles.Units,'Value')
f = str2num(get(handles.Frequency,'String'));
BW = 2.5*Pitch - 21.9*log10(X(AxNum)*f/300) + 21;
else
BW = 2.5*Pitch - 21.9*log10(X(AxNum)) + 21;
end
set(hObject,'CurrentAxes',handles.axes3);
Vis = get(handles.axes3,'Visible');
plot(Pitch,BW);
xlabel('\bf Pitch (degrees)');
ylabel('\bf %Bandwidth');
set(handles.axes3,'ButtonDownFcn',{@ButtonDownFcn,gcbf});
set((get(handles.axes3,'Children')),'HitTest','Off');
SetAxis(Pitch,BW)
[X(3),Y(3)] = crosshair('setx',X(3));
if get(handles.Grid,'Value')
grid(handles.axes3);
end
set(handles.axes3,'XLim',get(handles.axes2,'YLim'));
set(get(handles.axes3,'Children'),'Visible',Vis)
axis(handles.axes3,Vis)
function ButtonDownFcn(src,eventdata,FigHandle)
set(gcbf,'WindowButtonUpFcn',{@WindowButtonUpFcn,gcbf})
HelicalInteractive(gcbf,'move');
set(gcbf,'WindowButtonMotionFcn',{@WindowButtonMotionFcn,gcbf})
function WindowButtonMotionFcn(src,eventdata,FigHandle)
HelicalInteractive(FigHandle,'move');
function WindowButtonUpFcn(src,eventdata,FigHandle)
set(FigHandle,'WindowButtonMotionFcn','');
set(FigHandle,'WindowButtonUpFcn','');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -