📄 amplifiergui.m
字号:
Bias=round(get(hObject,'Value'));
set(handles.BiasText2,'String',num2str(Bias));
fprintf(handles.SAmp2,['BSLV' num2str(Bias)]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function BiasText1_CreateFcn(hObject, eventdata, handles)
% hObject handle to BiasText1 (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 BiasText1_Callback(hObject, eventdata, handles)
% hObject handle to BiasText1 (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 BiasText1 as text
% str2double(get(hObject,'String')) returns contents of BiasText1 as a double
Bias = round(str2double(get(hObject,'String')));
if (Bias<-5000) | (Bias>5000) | isnan(Bias)
Bias=0;
end
set(hObject,'String',sprintf('%d',Bias));
set(handles.BiasSlider1,'Value',Bias);
fprintf(handles.SAmp1,['BSLV' num2str(Bias)]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function BiasText2_CreateFcn(hObject, eventdata, handles)
% hObject handle to BiasText2 (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 BiasText2_Callback(hObject, eventdata, handles)
% hObject handle to BiasText2 (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 BiasText2 as text
% str2double(get(hObject,'String')) returns contents of BiasText2 as a double
Bias = round(str2double(get(hObject,'String')));
if (Bias<-5000) | (Bias>5000) | isnan(Bias)
Bias=0;
end
set(hObject,'String',sprintf('%d',Bias));
set(handles.BiasSlider2,'Value',Bias);
fprintf(handles.SAmp2,['BSLV' num2str(Bias)]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in Freq11.
function Freq11_Callback(hObject, eventdata, handles)
% hObject handle to Freq11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.Freq21,'Value',0)
set(handles.Freq31,'Value',0)
Freq=get(handles.Freq11,'Value')*13 + get(handles.Freq21,'Value')*14 + get(handles.Freq31,'Value')*15;
fprintf(handles.SAmp1,['LFRQ' num2str(Freq)]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in Freq21.
function Freq21_Callback(hObject, eventdata, handles)
% hObject handle to Freq21 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.Freq11,'Value',0)
set(handles.Freq31,'Value',0)
Freq=get(handles.Freq11,'Value')*13 + get(handles.Freq21,'Value')*14 + get(handles.Freq31,'Value')*15;
fprintf(handles.SAmp1,['LFRQ' num2str(Freq)]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in Freq31.
function Freq31_Callback(hObject, eventdata, handles)
% hObject handle to Freq31 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.Freq11,'Value',0)
set(handles.Freq21,'Value',0)
Freq=get(handles.Freq11,'Value')*13 + get(handles.Freq21,'Value')*14 + get(handles.Freq31,'Value')*15;
fprintf(handles.SAmp1,['LFRQ' num2str(Freq)]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in Freq12.
function Freq12_Callback(hObject, eventdata, handles)
% hObject handle to Freq12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.Freq22,'Value',0)
set(handles.Freq32,'Value',0)
Freq=get(handles.Freq12,'Value')*13 + get(handles.Freq22,'Value')*14 + get(handles.Freq32,'Value')*15;
fprintf(handles.SAmp2,['LFRQ' num2str(Freq)]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in Freq22.
function Freq22_Callback(hObject, eventdata, handles)
% hObject handle to Freq22 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.Freq12,'Value',0)
set(handles.Freq32,'Value',0)
Freq=get(handles.Freq12,'Value')*13 + get(handles.Freq22,'Value')*14 + get(handles.Freq32,'Value')*15;
fprintf(handles.SAmp2,['LFRQ' num2str(Freq)]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in Freq32.
function Freq32_Callback(hObject, eventdata, handles)
% hObject handle to Freq32 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.Freq12,'Value',0)
set(handles.Freq22,'Value',0)
Freq=get(handles.Freq12,'Value')*13 + get(handles.Freq22,'Value')*14 + get(handles.Freq32,'Value')*15;
fprintf(handles.SAmp2,['LFRQ' num2str(Freq)]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in Invert1.
function Invert1_Callback(hObject, eventdata, handles)
% hObject handle to Invert1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of Invert1
fprintf(handles.SAmp1,['INVT' num2str(get(handles.Invert1,'Value'))]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in Invert2.
function Invert2_Callback(hObject, eventdata, handles)
% hObject handle to Invert2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
fprintf(handles.SAmp2,['INVT' num2str(get(handles.Invert2,'Value'))]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in LNAmp1.
function LNAmp1_Callback(hObject, eventdata, handles)
% hObject handle to LNAmp1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of LNAmp1
fprintf(handles.SAmp1,['GNMD' num2str(1-get(handles.LNAmp1,'Value'))]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in LNAmp2.
function LNAmp2_Callback(hObject, eventdata, handles)
% hObject handle to LNAmp2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of LNAmp2
fprintf(handles.SAmp2,['GNMD' num2str(1-get(handles.LNAmp2,'Value'))]);
% Update parameters
Update(handles);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Update(handles)
% Update the parameter values of the Amplifier to the Main window
% Load parameters from the Main window
Main_handles=guidata(handles.Main);
% Update parameters
% Amplifier#1
Main_handles.Sensit1=27-get(handles.SensitSlider1,'Value');
Main_handles.Offset1=get(handles.OffsetSlider1,'Value');
Main_handles.Bias1=get(handles.BiasSlider1,'Value');
Main_handles.CutOffFreq1=get(handles.Freq11,'Value')*100 + get(handles.Freq21,'Value')*300 + get(handles.Freq31,'Value')*1000;
Main_handles.LNAmp1=1-get(handles.LNAmp1,'Value');
Main_handles.Invert1=get(handles.Invert1,'Value');
% Amplifier#2
Main_handles.Sensit2=27-get(handles.SensitSlider2,'Value');
Main_handles.Offset2=get(handles.OffsetSlider2,'Value');
Main_handles.Bias2=get(handles.BiasSlider2,'Value');
Main_handles.CutOffFreq2=get(handles.Freq12,'Value')*100 + get(handles.Freq22,'Value')*300 + get(handles.Freq32,'Value')*1000;
Main_handles.LNAmp2=1-get(handles.LNAmp2,'Value');
Main_handles.Invert2=get(handles.Invert2,'Value');
% Save parameters to the Main window
guidata(handles.Main,Main_handles);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -