2.App主要程序如下
classdef yiciyidongapp < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
Panel matlab.ui.container.Panel
Panel_2 matlab.ui.container.Panel
Button matlab.ui.control.Button
Label_3 matlab.ui.control.Label
EditField matlab.ui.control.NumericEditField
Label_4 matlab.ui.control.Label
EditField_2 matlab.ui.control.NumericEditField
Label_5 matlab.ui.control.Label
EditField_3 matlab.ui.control.NumericEditField
xEditFieldLabel matlab.ui.control.Label
xEditField matlab.ui.control.EditField
yEditFieldLabel matlab.ui.control.Label
yEditField matlab.ui.control.EditField
EditField_4Label matlab.ui.control.Label
EditField_4 matlab.ui.control.EditField
Panel_3 matlab.ui.container.Panel
Button_2 matlab.ui.control.Button
Button_3 matlab.ui.control.Button
Button_4 matlab.ui.control.Button
Panel_4 matlab.ui.container.Panel
UIAxes matlab.ui.control.UIAxes
TextArea matlab.ui.control.TextArea
UITable matlab.ui.control.Table
Label matlab.ui.control.Label
UITable_2 matlab.ui.control.Table
Label_2 matlab.ui.control.Label
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: Button_3
function Button_3Pushed(app, event)
app.EditField.Value = 0;
app.EditField_2.Value = 0;
app.EditField_3.Value = 0;
app.EditField_4.Value = " ";
app.xEditField.Value = " ";
app.yEditField.Value = " ";
app.UITable.Data = [];%矩阵数据使表格为空
app.UITable_2.Data = [];
try
delete(allchild(app.UIAxes));
end
end
% Button pushed function: Button_4
function Button_4Pushed(app, event)
closereq;
end
% Button pushed function: Button
function ButtonPushed(app, event)
%加载数据 使用全局变量传递加载的数据
global data12
[filename,pathname,filterindex]=uigetfile({'*.xlsx';'*.txt';'*.*'},'打开数据');
if ~filename
return;
end
str1=[pathname,filename];
if (filename==0 & pathname==0)
msgbox('您没有选择文件,请重新选择!','打开文件出错','error');
else
% data=xlsread (strcat([pathname filename])); %strcat是组成路径的。
data12 = xlsread (strcat([pathname filename]));
msgbox('打开及读取数据完毕!','确认','warn');
end
end
本文内容来源于网络,仅供参考学习,如内容、图片有任何版权问题,请联系处理,24小时内删除。
作 者 | 郭志龙
编 辑 | 郭志龙
校 对 | 郭志龙