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

📄 t_10.m

📁 用matlab实现的拥有图形化的交互界面
💻 M
📖 第 1 页 / 共 3 页
字号:





function M_edit1_Callback(hObject, eventdata, handles)
% hObject    handle to M_edit1 (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 M_edit1 as text
%        str2double(get(hObject,'String')) returns contents of M_edit1 as a double


% --- Executes during object creation, after setting all properties.
function M_edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to M_edit1 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --------------------------------------------------------------------
function M_ta_Callback(hObject, eventdata, handles)
% hObject    handle to M_ta (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global AA;
a1=max(AA,[],2);
a2=min(AA,[],2);
answer=[num2str(a1),num2str(a2)];
set(handles.M_answer,'String',answer);



% --------------------------------------------------------------------
function M_tb_Callback(hObject, eventdata, handles)
% hObject    handle to M_tb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global AA;
b1=max(AA);
b2=min(AA);
answer=[num2str(b1),num2str(b2)];
set(handles.M_answer,'String',answer);


% --------------------------------------------------------------------
function M_tc_Callback(hObject, eventdata, handles)
% hObject    handle to M_tc (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global AA;
c=sum(AA,1);
answer=num2str(c);
set(handles.M_answer,'String',answer);



% --------------------------------------------------------------------
function M_td_Callback(hObject, eventdata, handles)
% hObject    handle to M_td (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global AA;
d=mean(AA);
answer=num2str(d);
set(handles.M_answer,'String',answer);





function M_edit2_Callback(hObject, eventdata, handles)
% hObject    handle to M_edit2 (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 M_edit2 as text
%        str2double(get(hObject,'String')) returns contents of M_edit2 as a double


% --- Executes during object creation, after setting all properties.
function M_edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to M_edit2 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --------------------------------------------------------------------
function M_ZGH22_Callback(hObject, eventdata, handles)
% hObject    handle to M_ZGH22 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global topicnum;
topicnum=22;
topicstr='22、使用switch结构,编写一个程序完成以下功能:给定一个角度(-360度~360度),会告诉你是东、南、西、北,东南、东北、西南、西北这8个方向中的哪个方向,请以正东为0度,逆时针旋转。例如,输入40,应显示东北。输入-40,显示东南,如果输入的数不符合要求,则提示出错。';
set(handles.M_topic,'String',topicstr);





function M_edit3_Callback(hObject, eventdata, handles)
% hObject    handle to M_edit3 (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 M_edit3 as text
%        str2double(get(hObject,'String')) returns contents of M_edit3 as a double


% --- Executes during object creation, after setting all properties.
function M_edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to M_edit3 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --------------------------------------------------------------------
function M_2pie_Callback(hObject, eventdata, handles)
% hObject    handle to M_2pie (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
x=[20,25,20,35];
y=[0,1,0,0];
axes(handles.M_axes);
pie(x,y,{'饭费','娱乐','购物','学习'});
title('大学生每月的消费');


% --------------------------------------------------------------------
function M_3pie_Callback(hObject, eventdata, handles)
% hObject    handle to M_3pie (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
x=[20,25,20,35];
y=[0,1,0,0];
axes(handles.M_axes);
pie3(x,y,{'饭费','娱乐','购物','学习'});
title('大学生每月的消费');




% --------------------------------------------------------------------
function M_YG29_Callback(hObject, eventdata, handles)
% hObject    handle to M_YG29 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global topicnum;
topicnum=29;
topicstr='29、求 和 。提示,用int命令。如何表示对哪个变量进行积分呢?这是这道题要考查的目的。';
set(handles.M_topic,'String',topicstr);


% --------------------------------------------------------------------
function M_YG30_Callback(hObject, eventdata, handles)
% hObject    handle to M_YG30 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global topicnum;
topicnum=30;
topicstr='30、求 , , , 的极限。提示,用limit命令。还是那个问题,如何表示用哪个变量趋于某一数呢?哈哈,题目都出完了,你们也额外尝到了符号运算的方法,把这些教给师弟师妹吧,他们可能正为高数和线性代数而苦恼呢。';
set(handles.M_topic,'String',topicstr);





function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to M_edit2 (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 M_edit2 as text
%        str2double(get(hObject,'String')) returns contents of M_edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to M_edit2 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit3_Callback(hObject, eventdata, handles)
% hObject    handle to M_edit3 (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 M_edit3 as text
%        str2double(get(hObject,'String')) returns contents of M_edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to M_edit3 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



% --------------------------------------------------------------------
function M_a_Callback(hObject, eventdata, handles)
% hObject    handle to M_a (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global A;
global B;
answer=num2str(B(2,:));
set(handles.M_answer,'String',answer);


% --------------------------------------------------------------------
function M_b_Callback(hObject, eventdata, handles)
% hObject    handle to M_b (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global A;
global B;
answer=num2str(sum(single(B(2,:))));
set(handles.M_answer,'String',answer);


% --------------------------------------------------------------------
function M_c_Callback(hObject, eventdata, handles)
% hObject    handle to M_c (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global A;
global B;
global C;
C=B(:,2).*A(:,1)
answer=num2str(C);
set(handles.M_answer,'String',answer);


% --------------------------------------------------------------------
function M_d_Callback(hObject, eventdata, handles)
% hObject    handle to M_d (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global A;
global B;
global C;
answer=[num2str(max(C)),'     ',num2str(find(max(C)))];
set(handles.M_answer,'String',answer);


% --------------------------------------------------------------------
function M_e_Callback(hObject, eventdata, handles)
% hObject    handle to M_e (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global A;
global B;
answer=num2str(A.^2);
set(handles.M_answer,'String',answer);


% --------------------------------------------------------------------
function M_YFY4_Callback(hObject, eventdata, handles)
% hObject    handle to M_YFY4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global topicnum;
topicnum=4;
topicstr='4、请确定数组[sin(-π/2):0.05:cos(0)]的元素个数,并给出第10个元素的值。元素个数请在第一个编辑框中显示,第10个元素的值请在第二个编辑框中显示。';
set(handles.M_topic,'String',topicstr);




% --------------------------------------------------------------------
function M_YFY14_Callback(hObject, eventdata, handles)
% hObject    handle to M_YFY14 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global topicnum;
topicnum=14;
topicstr='14、计算 的商和余数。提示,用deconv命令。';
set(handles.M_topic,'String',topicstr);



% --------------------------------------------------------------------
function M_ZPS28_Callback(hObject, eventdata, handles)
% hObject    handle to M_ZPS28 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global topicnum;
topicnum=28;
topicstr='28、求 的一阶导数和三阶导数。要求这两个导数都只用一个命令就完成。提示,用diff命令。那如何在diff里表示求几阶导数呢?';
set(handles.M_topic,'String',topicstr);



% --- Executes on button press in M_quit.
function M_quit_Callback(hObject, eventdata, handles)
% hObject    handle to M_quit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
close;




% --------------------------------------------------------------------
function M_XY20_Callback(hObject, eventdata, handles)
% hObject    handle to M_XY20 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global topicnum;
topicnum=20;
topicstr='20、上一题请用for循环和条件语句来生成数组B。显示B,不用保存B。';
set(handles.M_topic,'String',topicstr);


⌨️ 快捷键说明

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