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

📄 gui_findbeta.m

📁 利用电磁场的源激发方法来计算光子晶体波导例如光子晶体光纤
💻 M
📖 第 1 页 / 共 2 页
字号:
handles.output = guidata(gcbo);% Update handles structureguidata(hObject, handles);% Use UIRESUME instead of delete because the OutputFcn needs% to get the updated handles structure.uiresume(handles.figure1);% --- Executes on button press in cancel.function cancel_Callback(hObject, eventdata, handles)% hObject    handle to cancel (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)handles.status = -1;guidata(hObject, handles);handles.output = guidata(gcbo);% Update handles structureguidata(hObject, handles);% Use UIRESUME instead of delete because the OutputFcn needs% to get the updated handles structure.uiresume(handles.figure1);% --- Executes during object creation, after setting all properties.function slider1_CreateFcn(hObject, eventdata, handles)% hObject    handle to slider1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: slider controls usually have a light gray background, change%       'usewhitebg' to 0 to use default.  See ISPC and COMPUTER.usewhitebg = 1;if usewhitebg    set(hObject,'BackgroundColor',[.9 .9 .9]);else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function slider1_Callback(hObject, eventdata, handles)% hObject    handle to slider1 (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,'Value') returns position of slider%        get(hObject,'Min') and get(hObject,'Max') to determine range of sliderset(handles.sm_text, 'String', get(hObject, 'Value'));handles.sm = get(hObject, 'Value');guidata(hObject, handles);% --- Executes during object creation, after setting all properties.function tol_edit_CreateFcn(hObject, eventdata, handles)% hObject    handle to tol_edit (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'));endfunction tol_edit_Callback(hObject, eventdata, handles)% hObject    handle to tol_edit (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 tol_edit as text%        str2double(get(hObject,'String')) returns contents of tol_edit as a doubleNewStrVal = get(hObject, 'String');NewVal = str2double(NewStrVal);% Check that the entered value falls within the allowable rangeif  isnan(NewVal) | (NewVal < 1e-16) | (NewVal > 1),        set(hObject, 'String', handles.tol);else    handles.tol = NewVal;    guidata(hObject, handles);end% --- Executes on button press in checkbox1.function checkbox1_Callback(hObject, eventdata, handles)% hObject    handle to checkbox1 (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 checkbox1handles.bPlot = get(hObject, 'Value');guidata(hObject, handles);% --- Executes during object creation, after setting all properties.function sm_text_CreateFcn(hObject, eventdata, handles)% hObject    handle to sm_text (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'));endfunction sm_text_Callback(hObject, eventdata, handles)% hObject    handle to sm_text (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 sm_text as text%        str2double(get(hObject,'String')) returns contents of sm_text as a doubleNewStrVal = get(hObject, 'String');NewVal = str2double(NewStrVal);% Check that the entered value falls within the allowable rangeif  isnan(NewVal) | (NewVal < 1) | (NewVal > 3),        OldVal = get(handles.slider1,'Value');        set(hObject, 'String',OldVal);else    set(handles.slider1, 'Value', str2num(get(hObject, 'String')));    handles.sm = NewVal;    guidata(hObject, handles);endfunction uiNstart_Callback(hObject, eventdata, handles)% hObject    handle to uiNstart (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 uiNstart as text%        str2double(get(hObject,'String')) returns contents of uiNstart as a doubleNewStrVal = get(hObject, 'String');NewVal = str2double(NewStrVal);% Check that the entered value falls within the allowable rangeif  isnan(NewVal) | (NewVal < 3)    set(hObject, 'String', handles.nStart_val);else    handles.nStart_val = round(NewVal);    guidata(hObject, handles);end% --- Executes during object creation, after setting all properties.function uiNstart_CreateFcn(hObject, eventdata, handles)% hObject    handle to uiNstart (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'));endfunction uiMaxLambda_Callback(hObject, eventdata, handles)% hObject    handle to uiMaxLambda (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 uiMaxLambda as text%        str2double(get(hObject,'String')) returns contents of uiMaxLambda as a doublex = str2double(get(hObject,'String'));if isnan(x) | x < 0     set(hObject, 'String', num2str(handles.max_lambda_val));else    handles.max_lambda_val = x;    guidata(hObject, handles)end% --- Executes during object creation, after setting all properties.function uiMaxLambda_CreateFcn(hObject, eventdata, handles)% hObject    handle to uiMaxLambda (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'));endfunction uiNLambda_Callback(hObject, eventdata, handles)% hObject    handle to uiNLambda (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)NewStrVal = get(hObject, 'String');NewVal = round(str2double(NewStrVal));% Check that the entered value falls within the allowable rangeif  isnan(NewVal) | (NewVal < 1)    set(hObject, 'String', handles.nLambda_val);else    if NewVal == 1        hide_range(handles)    else        show_range(handles)    end    set(hObject, 'string', num2str(NewVal));    handles.nLambda_val = NewVal;    guidata(hObject, handles);end% --- Executes during object creation, after setting all properties.function uiNLambda_CreateFcn(hObject, eventdata, handles)% hObject    handle to uiNLambda (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'));endfunction show_range(handles)set(handles.uiMinText, 'string', 'Minimum:');set(handles.uiMaxText, 'visible', 'on');set(handles.uiMaxLambda, 'visible', 'on');set(handles.uiMText, 'visible', 'on');set(handles.uiTextDisp, 'visible', 'off');function hide_range(handles)set(handles.uiMinText, 'string', 'Wavelength:');set(handles.uiMaxText, 'visible', 'off');set(handles.uiMaxLambda, 'visible', 'off');set(handles.uiMText, 'visible', 'off');set(handles.uiTextDisp, 'visible', 'on');

⌨️ 快捷键说明

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