- GUI调出文件读取框
[filename,pathname] = uigetfile({'*.xlsx';'*.xls';'*.*'},'选择文件'); strh = [pathname,filename]; %存储文件的路径及名称 global num txt raw [num,txt,raw] = xlsread(strh); %读取数据
- GUI清空坐标系和文本框
axes(handles.axes1); %指定需要清空的坐标轴 cla reset; set(handles.text4,'String',[]); set(handles.text5,'String',[]); set(handles.text6,'String',[]);
- GUI关闭界面
closereq;
- GUI界面标题
function xianxingjiemian_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to xianxingjiemian (see VARARGIN) % Choose default command line output for xianxingjiemian handles.output = hObject; movegui(gcf,'center'); set(gcf,'NumberTitle','off','Name','基于MATLAB的自动控制系统人机交互界面设计'); % Update handles structure guidata(hObject, handles);
- GUI单选按钮互斥
function radiobutton1_Callback(hObject, eventdata, handles) % hObject handle to radiobutton1 (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 radiobutton1 set(handles.radiobutton1,'value',1); set(handles.radiobutton2,'value',0);
- GUI清除坐标系
try delete(allchild(handles.axes3)); %清除坐标系3中的图像 end
- cell转化成string
txt = {}; string = cell2mat(txt);
- 方程组数值解
syms lbd theta3 theta4 eqn = [xe+l4*cos(theta4)+lbd*cos(theta3)-l1*cos(theta1)== 0,... ye+l4*sin(theta4)+lbd*sin(theta3)-l1*sin(theta1)== 0,... l4*sin(theta4)+l3*sin(theta3)-h== 0]; [lbd, theta3, theta4] = vpasolve(eqn, [lbd, theta3, theta4],[0,l3; pi/4,9*pi/16; 11*pi/8,2*pi]);
- 方程组解析解
syms x y eqns = [x^2 + y^2 == 5, x - y == 1]; vars = [x y]; [x, y] = solve(eqns, vars)
- latex代码
latex(df) %转换为latex代码