📄 sonnetantennadesigngui.m
字号:
if isnan(Height)
set(hObject, 'String', 50);
errordlg('Input must be a number','Error');
end
data = getappdata(gcbf, 'metricdata');
data.Height = Height;
setappdata(gcbf, 'metricdata', data);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% START Zin Block %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function Zin_CreateFcn(hObject, eventdata, handles)
% hObject handle to Zin (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function Zin_Callback(hObject, eventdata, handles)
% hObject handle to Zin (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Zin as text
% str2double(get(hObject,'String')) returns contents of Zin as a double
Zin = str2double(get(hObject, 'String'));
if isnan(Zin)
set(hObject, 'String', 50);
errordlg('Input must be a number','Error');
end
data = getappdata(gcbf, 'metricdata');
data.Zin = Zin;
setappdata(gcbf, 'metricdata', data);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% START GenSim Block %%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in GenSim.
function GenSim_Callback(hObject, eventdata, handles)
% hObject handle to GenSim (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clc
data = getappdata(gcbf, 'metricdata');
GenerateSimulate(data.Freq, data.Zin, data.Height, data.Perm, data.LossTangentD, data.MetalCond, data.MetalThickness);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
initialize_gui(gcbf, handles);
function initialize_gui(fig_handle, handles)
data.Height = 50;
data.Freq = 1;
data.Perm = 2;
data.Zin = 50;
data.LossTangentD = 0.0013;
data.MetalCond = inf;
data.MetalThickness = 0.7;
setappdata(fig_handle, 'metricdata', data);
set(handles.Freq, 'String', data.Freq);
set(handles.Perm, 'String', data.Perm);
set(handles.Height, 'String', data.Height);
set(handles.Zin, 'String', data.Zin);
set(handles.MetalCond, 'String', data.MetalCond);
set(handles.MetalThickness, 'String', data.MetalThickness);
set(handles.LossTangentD, 'String', data.LossTangentD);
function MetalCond_Callback(hObject, eventdata, handles)
% hObject handle to MetalCond (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of MetalCond as text
% str2double(get(hObject,'String')) returns contents of MetalCond as a double
MetalCond = str2double(get(hObject, 'String'));
if isnan(MetalCond)
set(hObject, 'String', 50);
errordlg('Input must be a number','Error');
end
data = getappdata(gcbf, 'metricdata');
data.MetalCond = MetalCond;
setappdata(gcbf, 'metricdata', data);
% --- Executes during object creation, after setting all properties.
function MetalCond_CreateFcn(hObject, eventdata, handles)
% hObject handle to MetalCond (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function MetalThickness_Callback(hObject, eventdata, handles)
% hObject handle to MetalThickness (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of MetalThickness as text
% str2double(get(hObject,'String')) returns contents of MetalThickness as a double
MetalThickness = str2double(get(hObject, 'String'));
if isnan(MetalThickness)
set(hObject, 'String', 50);
errordlg('Input must be a number','Error');
end
data = getappdata(gcbf, 'metricdata');
data.MetalThickness = MetalThickness;
setappdata(gcbf, 'metricdata', data);
% --- Executes during object creation, after setting all properties.
function MetalThickness_CreateFcn(hObject, eventdata, handles)
% hObject handle to MetalThickness (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function LossTangentD_Callback(hObject, eventdata, handles)
% hObject handle to LossTangentD (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of LossTangentD as text
% str2double(get(hObject,'String')) returns contents of LossTangentD as a double
LossTangentD = str2double(get(hObject, 'String'));
if isnan(LossTangentD)
set(hObject, 'String', 50);
errordlg('Input must be a number','Error');
end
data = getappdata(gcbf, 'metricdata');
data.LossTangentD = LossTangentD;
setappdata(gcbf, 'metricdata', data);
% --- Executes during object creation, after setting all properties.
function LossTangentD_CreateFcn(hObject, eventdata, handles)
% hObject handle to LossTangentD (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -