classdef DPAS_for_102Lab < matlab.apps.AppBase

    % Properties that correspond to app components
    properties (Access = public)
        DPAS102LabUIFigure          matlab.ui.Figure
        TabGroup                    matlab.ui.container.TabGroup
        MainTab                     matlab.ui.container.Tab
        LabDataProcessAnalysisSystemLabel  matlab.ui.control.Label
        ProcessAnalysisButton       matlab.ui.control.StateButton
        GlobalSettingButton         matlab.ui.control.StateButton
        AnaDataTab                  matlab.ui.container.Tab
        DataListBox                 matlab.ui.control.ListBox
        DataLabel                   matlab.ui.control.Label
        Panel_2                     matlab.ui.container.Panel
        KeyVariableListBox          matlab.ui.control.ListBox
        EditKey                     matlab.ui.control.EditField
        Panel_3                     matlab.ui.container.Panel
        VariableListBox             matlab.ui.control.ListBox
        VariableLabel               matlab.ui.control.Label
        SearchButton                matlab.ui.control.Button
        ListButton                  matlab.ui.control.Button
        PlotGroup                   matlab.ui.container.TabGroup
        PlotTab                     matlab.ui.container.Tab
        TIMEPLOTPanel               matlab.ui.container.Panel
        TIMEPLOTButton              matlab.ui.control.Button
        FEATUREPLOTPanel            matlab.ui.container.Panel
        FEATUREPLOTButton           matlab.ui.control.Button
        FeatureDropDown_5Label      matlab.ui.control.Label
        FeatureDropDown             matlab.ui.control.DropDown
        AverageDropDownLabel        matlab.ui.control.Label
        AverageDropDown             matlab.ui.control.DropDown
        STRIDEPLOTPanel             matlab.ui.container.Panel
        STRIDEPLOTButton            matlab.ui.control.Button
        meanCheckBox                matlab.ui.control.CheckBox
        stdCheckBox                 matlab.ui.control.CheckBox
        eachCheckBox                matlab.ui.control.CheckBox
        STRIDEINTERVALPLOTPanel     matlab.ui.container.Panel
        ALTERStridePlotButton_3     matlab.ui.control.Button
        IntervalStepsDropDownLabel  matlab.ui.control.Label
        IntervalStepsDropDown       matlab.ui.control.DropDown
        SIGNELSTRIDEPLOTPanel       matlab.ui.container.Panel
        ALTERStridePlotButton_5     matlab.ui.control.Button
        StepsNumDropDownLabel       matlab.ui.control.Label
        StepsNumDropDown            matlab.ui.control.DropDown
        AverageNumDropDownLabel     matlab.ui.control.Label
        AverageNumDropDown          matlab.ui.control.DropDown
        UpdateButton                matlab.ui.control.Button
        TrajectoryPLOTPanel         matlab.ui.container.Panel
        ALTERStridePlotButton_4     matlab.ui.control.Button
        StepsDropDownLabel          matlab.ui.control.Label
        StepsDropDown               matlab.ui.control.DropDown
        LinecolorDropDownLabel      matlab.ui.control.Label
        LinecolorDropDown           matlab.ui.control.DropDown
        PlotTypeDropDownLabel       matlab.ui.control.Label
        PlotTypeDropDown            matlab.ui.control.DropDown
        BarTab                      matlab.ui.container.Tab
        FEATURESBARPLOTPanel        matlab.ui.container.Panel
        ClassListBox                matlab.ui.control.ListBox
        GroupListBox                matlab.ui.control.ListBox
        ClassLabel                  matlab.ui.control.Label
        GroupLabel                  matlab.ui.control.Label
        Panel_14                    matlab.ui.container.Panel
        ClassAddButton_3            matlab.ui.control.Button
        ClassClearButton_3          matlab.ui.control.Button
        ClassDeleteButton_3         matlab.ui.control.Button
        ClassUpButton_3             matlab.ui.control.Button
        ClassRenameButton           matlab.ui.control.Button
        ClassDownButton_3           matlab.ui.control.Button
        GroupAddButton              matlab.ui.control.Button
        GroupClearButton            matlab.ui.control.Button
        GroupDeleteButton           matlab.ui.control.Button
        GroupUpButton               matlab.ui.control.Button
        GroupRenameButton           matlab.ui.control.Button
        GroupDownButton             matlab.ui.control.Button
        VarAlterPlotButton          matlab.ui.control.Button
        CHANGECOLORButton           matlab.ui.control.Button
        FeatureDropDown_2Label_5    matlab.ui.control.Label
        BarFeatureDropDown          matlab.ui.control.DropDown
        GroupIndexDropDownLabel     matlab.ui.control.Label
        GroupIndexDropDown          matlab.ui.control.DropDown
        TypeDropDownLabel           matlab.ui.control.Label
        BarTypeDropDown             matlab.ui.control.DropDown
        ALTERNEWButton_9            matlab.ui.control.Button
        GROUPPLOTButton             matlab.ui.control.Button
        FitTab                      matlab.ui.container.Tab
        FITTINGANALYSISPanel        matlab.ui.container.Panel
        ClassAddButton_4            matlab.ui.control.Button
        ClassClearButton_4          matlab.ui.control.Button
        ClassDeleteButton_4         matlab.ui.control.Button
        FeatureDropDown_2Label_6    matlab.ui.control.Label
        FitFeatureDropDown          matlab.ui.control.DropDown
        ALTERNEWButton_10           matlab.ui.control.Button
        FittingTable                matlab.ui.control.Table
        AddLabelXButton             matlab.ui.control.Button
        AddLabelYButton             matlab.ui.control.Button
        FittingButton1              matlab.ui.control.Button
        FittingMethodDropDown1      matlab.ui.control.DropDown
        FittingMethodDropDown2      matlab.ui.control.DropDown
        FittingButton2              matlab.ui.control.Button
        SignifTab                   matlab.ui.container.Tab
        SIGNIFICANCEANALYSISPanel   matlab.ui.container.Panel
        AddGroupButton              matlab.ui.control.Button
        ClearGroupButton            matlab.ui.control.Button
        DeleteGroupButton           matlab.ui.control.Button
        SigTable                    matlab.ui.control.Table
        AddDataButton1              matlab.ui.control.Button
        AddDataButton2              matlab.ui.control.Button
        ClassUpButton_4             matlab.ui.control.Button
        ClassDownButton_4           matlab.ui.control.Button
        GroupDataListBox            matlab.ui.control.ListBox
        AddDataButton2_2            matlab.ui.control.Button
        FeatureDropDown_2Label_7    matlab.ui.control.Label
        SigFeatureDropDown          matlab.ui.control.DropDown
        NormalityAnaButton          matlab.ui.control.Button
        VarAnaButton                matlab.ui.control.Button
        VarAnaButton_2              matlab.ui.control.Button
        VarAnaButton_3              matlab.ui.control.Button
        VarAnaButton_4              matlab.ui.control.Button
        VarAnaButton_5              matlab.ui.control.Button
        ToolButtonGroup             matlab.ui.container.ButtonGroup
        LoadTabButton               matlab.ui.control.Button
        VarEditTabButton            matlab.ui.control.Button
        PlotSetTabButton            matlab.ui.control.Button
        ToolTabGroup                matlab.ui.container.TabGroup
        LoadTab                     matlab.ui.container.Tab
        LOADDATAButton              matlab.ui.control.Button
        DELETEDATAButton            matlab.ui.control.Button
        SAVEVARButton               matlab.ui.control.Button
        ExtractSCONEDataButton      matlab.ui.control.Button
        VarEditTab                  matlab.ui.container.Tab
        DiveideScanButton           matlab.ui.control.Button
        DeleteStepsButton           matlab.ui.control.Button
        DivideDataButton            matlab.ui.control.Button
        MergeDataButton             matlab.ui.control.Button
        RenameVarButton             matlab.ui.control.Button
        DelVarButton                matlab.ui.control.Button
        NormalVarButton             matlab.ui.control.Button
        PROCESSButton               matlab.ui.control.Button
        PROCESSALLButton            matlab.ui.control.Button
        BiasVarButton               matlab.ui.control.Button
        PlotSetTab                  matlab.ui.container.Tab
        ColorMapAxes                matlab.ui.control.UIAxes
        Lamp                        matlab.ui.control.Button
        Button                      matlab.ui.control.Button
        Button_3                    matlab.ui.control.Button
        LineWidthDropDownLabel      matlab.ui.control.Label
        LineWidthDropDown           matlab.ui.control.DropDown
        LineTypeDropDownLabel       matlab.ui.control.Label
        LineTypeDropDown            matlab.ui.control.DropDown
        MarkerSizeDropDownLabel     matlab.ui.control.Label
        MarkerSizeDropDown          matlab.ui.control.DropDown
        MarkerTypeDropDownLabel     matlab.ui.control.Label
        MarkerTypeDropDown          matlab.ui.control.DropDown
        ColorMapDropDown            matlab.ui.control.DropDown
        ColorMapLabel               matlab.ui.control.Label
        NEWButton                   matlab.ui.control.Button
        NEWSubButton                matlab.ui.control.Button
        SubRowDropDownLabel         matlab.ui.control.Label
        SubRowDropDown              matlab.ui.control.DropDown
        SubColDropDownLabel         matlab.ui.control.Label
        SubColDropDown              matlab.ui.control.DropDown
        SelectButton                matlab.ui.control.Button
        ClearLastButton             matlab.ui.control.Button
        ClearAllButton              matlab.ui.control.Button
        ReverseCheckBox             matlab.ui.control.CheckBox
        DataTypeTab                 matlab.ui.container.Tab
        dSPACEButton                matlab.ui.control.StateButton
        OpenSimButton               matlab.ui.control.StateButton
        PredSimButton               matlab.ui.control.StateButton
        SCONEButton                 matlab.ui.control.StateButton
        HistoryButton               matlab.ui.control.StateButton
        StepSelectTab               matlab.ui.container.Tab
        SelectstepstodeleteLabel    matlab.ui.control.Label
        StepListBox                 matlab.ui.control.ListBox
        OKButton                    matlab.ui.control.Button
        CANCELButton                matlab.ui.control.Button
        PlotButtonGroup             matlab.ui.container.ButtonGroup
        SIGNFIButton                matlab.ui.control.Button
        FITTINGButton               matlab.ui.control.Button
        GROUPBARButton              matlab.ui.control.Button
        PLOTButton                  matlab.ui.control.Button
        BACKButton                  matlab.ui.control.Button
        GlobalSetTab                matlab.ui.container.Tab
        SetBalckColor               matlab.ui.control.Button
        BACKButton_2                matlab.ui.control.Button
        SetBalckColor_2             matlab.ui.control.Button
        SetBalckColor_3             matlab.ui.control.Button
        SetBalckColor_4             matlab.ui.control.Button
        SetBalckColor_5             matlab.ui.control.Button
        SetBalckColor_6             matlab.ui.control.Button
    end


    properties (Access = private)
        data
        setting
        userfig
        userbar
        userpl
    end

    methods (Access = private)
        
        function updateVarTable(app)
            
            if strcmp(app.DataListBox.Value, 'NULL')
                app.VariableListBox.Items = {};
            elseif isempty(app.DataListBox.Value)
                app.VariableListBox.Items = {};
            else
                data_name = char(app.DataListBox.Value);
                if size(data_name,1) > 1
                    data_name = data_name(1,:);
                end
                eval(['app.VariableListBox.Items = app.data.' data_name '.name;']);
            end

        end
        
        function updateKeyVarTable(app)
            
            key = app.EditKey.Value;
            
            if strcmp(app.DataListBox.Value, 'NULL')
                app.KeyVariableListBox.Items = {};
            elseif isempty(app.DataListBox.Value)
                app.KeyVariableListBox.Items = {};
            elseif isempty(app.DataListBox.Value)
                app.KeyVariableListBox.Items = {};
            elseif isempty(key)
                app.KeyVariableListBox.Items = {};
            elseif strcmp(key, 'NULL')
                app.KeyVariableListBox.Items = {};
            else
                data_name = char(app.DataListBox.Value);
                if size(data_name,1) > 1
                    data_name = data_name(1,:);
                end
                eval(['var_name = app.data.' data_name '.name;']);
                find_key = strfind(var_name, key);
                key_var_num = 1;
                key_var_name = {};
                for var_index = 1:length(var_name)
                    if ~isempty(find_key{var_index})
                        key_var_name(key_var_num) = var_name(var_index);
                        key_var_num = key_var_num + 1;
                    end
                end
                app.KeyVariableListBox.Items = key_var_name;
                app.KeyVariableListBox.Value = {};
                app.VariableListBox.Value = {};
            end

        end
        
        function updateGroupData(app)
            if ~isempty(app.data.sig.selectedGroup)
                eval(['groupdata = app.data.sig.' app.data.sig.selectedGroup ';']);
                
                GroupDataList = {};
                for i=1:length(groupdata)
                    GroupDataList{i} = num2str(groupdata(i));
                end
                
                app.GroupDataListBox.Items = GroupDataList;
            else
                app.GroupDataListBox.Items = {};
            end
        end
        
        function loadDspaceData(app)
            [file_all,path,indx] = uigetfile('*.mat','Select the dSPACE MAT file','MultiSelect', 'on');
            
            if indx == 1
                % 加载数据
                if ischar(file_all)
                    file_all = {file_all};
                end
                for file_index = 1:length(file_all)
                    file = file_all{file_index};
                    data_name = ['dspace.' file(1:end-4)];
                    
                    load(fullfile(path, file));
                    eval(['DspaceData = ' data_name(8:end) ';']);
                    
                    % 数据转换
                    if isempty(app.data.name)
                        app.data.name = {data_name};
                    else
                        app.data.name(end+1) = {data_name};
                    end
                    
                    app.DataListBox.Items = app.data.name;
                    
                    % 添加时间数据
                    data_time = DspaceData.X(1).Data;var_name = 'time';
                    data_length = length(data_time);
                    name_temp = {var_name};
                    eval(['app.data.' data_name '.' var_name '.origin = data_time;']);
                    
                    
                    for var_index = 1:length(DspaceData.Y)
                        var_data = DspaceData.Y(var_index).Data;
                        
                        if length(var_data) == data_length
                            var_name = DspaceData.Y(var_index).Name;
                            var_name = strrep(var_name,'[','_');
                            var_name = strrep(var_name,']','');
                            var_name = strrep(var_name,' ','');
                            while ismember(1,strcmp(name_temp,var_name))
                                var_name = [var_name '_X'];
                            end
                            name_temp(end+1,1) = {var_name};
                            eval(['app.data.' data_name '.' var_name '.origin = var_data;']);
                        end
                    end
                    
                    
                    eval(['app.data.' data_name '.name = name_temp;']);
                    eval(['app.data.' data_name '.processFlag = false;']);
                    app.updateVarTable();
                end
            end
     
                end
        
        function loadPredSimData(app)
            % 选择文件
            [file_all,path,indx] = uigetfile('*.mat','Select the SCONE STO file','MultiSelect', 'on');
            
  
            if indx == 1
                if ischar(file_all)
                    file_all = {file_all};
                end
                for file_index = 1:length(file_all)
                    % 加载数据
                    file = file_all{file_index};
                    data_name = ['predsim.' file(1:end-4)];
                    
                    load(fullfile(path, file));
                    eval(['PredsimData = ' data_name(9:end) ';']);
                    
                    % 数据转换
                    if isempty(app.data.name)
                        app.data.name = {data_name};
                    else
                        app.data.name(end+1) = {data_name};
                    end
                    
                    app.DataListBox.Items = app.data.name;
                    
                    for var_index = 1:length(PredsimData.name)
                        var_name = char(PredsimData.name(var_index));
                        var_name = strrep(var_name,'.','_');
                        var_name = strrep(var_name,'-','_');
                        eval(['app.data.' data_name '.name(var_index,1) = {var_name};']);
                        eval(['app.data.' data_name '.' var_name '.origin = PredsimData.data(:,var_index)'';']);
                    end
                    
                    eval(['app.data.' data_name '.processFlag = false;']);
                    app.updateVarTable();
                end
            end
            
        end
        
        function loadOpenSimData(app)
             
            % 选择文件
            [file_all,path,indx] = uigetfile({'*.sto;*.mot'},'Select the OpenSim STO or MOT file','MultiSelect', 'on');
            
             
            if indx == 1
                if ischar(file_all)
                    file_all = {file_all};
                end
                for file_index = 1:length(file_all)
                    % 加载数据
                    file = file_all{file_index};
                    data_name = ['opensim.' file(1:end-4)];
                    
                    file_path = fullfile(path, file);
                    fp = fopen(file_path, 'rt');
                    
                    n_header = 0;
                    while ~strcmp(fgetl(fp), 'endheader')
                        n_header = n_header + 1;
                    end
                    
                    delimmiter = '	';
                    filename = file_path;
                    nheaderlines = n_header + 2;
                    DataStru = importdata(filename,delimmiter,nheaderlines);
                    OpenSimData.name = reshape(DataStru.colheaders,[length(DataStru.colheaders) 1]);
                    OpenSimData.data = DataStru.data;
                    
                    % 数据转换
                    if isempty(app.data.name)
                        app.data.name = {data_name};
                    else
                        app.data.name(end+1) = {data_name};
                    end
                    
                    app.DataListBox.Items = app.data.name;
                    
                    for var_index = 1:length(OpenSimData.name)
                        var_name = char(OpenSimData.name(var_index));
                        var_name = strrep(var_name,'/jointset/','');
                        var_name = strrep(var_name,'/forceset/','');
                        var_name = strrep(var_name,'.','_');
                        var_name = strrep(var_name,'-','_');
                        var_name = strrep(var_name,'/','_');
                        eval(['app.data.' data_name '.name(var_index,1) = {var_name};']);
                        eval(['app.data.' data_name '.' var_name '.origin = OpenSimData.data(:,var_index)'';']);
                    end
                    
                    eval(['app.data.' data_name '.processFlag = false;']);
                    app.updateVarTable();
                end
            end
        end
        
        function loadSconeData(app)
            % 选择文件
            [file_all,path,indx] = uigetfile('*.sto','Select the SCONE STO file','MultiSelect', 'on');

            if indx == 1
                if ischar(file_all)
                    file_all = {file_all};
                end
                for file_index = 1:length(file_all)
                    file = file_all{file_index};
                    data_name = ['scone.' file(1:end-4)];
                    
                    % 加载数据
                    delimmiter = '	';
                    filename = fullfile(path, file);
                    nheaderlines = 7;
                    DataStru = importdata(filename,delimmiter,nheaderlines);
                    SconeData.name = reshape(DataStru.colheaders,[length(DataStru.colheaders) 1]);
                    SconeData.data = DataStru.data;
                    
                    % 数据转换
                    if isempty(app.data.name)
                        app.data.name = {data_name};
                    else
                        app.data.name(end+1) = {data_name};
                    end
                    
                    app.DataListBox.Items = app.data.name;
                    
                    for var_index = 1:length(SconeData.name)
                        var_name = char(SconeData.name(var_index));
                        var_name = strrep(var_name,'.','_');
                        var_name = strrep(var_name,'-','_');
                        eval(['app.data.' data_name '.name(var_index,1) = {var_name};']);
                        eval(['app.data.' data_name '.' var_name '.origin = SconeData.data(:,var_index)'';']);
                    end
                    
                    eval(['app.data.' data_name '.processFlag = false;']);
                    app.updateVarTable();
                end
            end
        end
        
        
        function loadHistory(app)
            [file_all,path,indx] = uigetfile('*.mat','Select the dSPACE MAT file','MultiSelect', 'on');
            
            if indx == 1
                % 加载数据
                if ischar(file_all)
                    file_all = {file_all};
                end
                for file_index = 1:length(file_all)
                    
                    file = file_all{file_index};
                    
                    history = load(fullfile(path, file));
                    
                    for data_index = 1:length(history.data.name)
                        
                        if isempty(app.data.name)
                            app.data.name = history.data.name(data_index);
                        else
                            app.data.name(end+1) = history.data.name(data_index);
                        end
                        
                        eval(['app.data.' history.data.name{data_index} ' = history.data.' history.data.name{data_index} ';']);
 
                    end

                end
                
                app.DataListBox.Items = app.data.name;
                app.updateVarTable();
                
            end
        end
        
        function stride_index = getStrideIndexByState(app,state_temp)
            
            stride_index = [];
            num = 0;
            for index_i=1:length(state_temp)-1
                if state_temp(index_i) == 0 && state_temp(index_i+1) == 1
                    num = num + 1;
                    stride_index(num) = index_i;
                end
            end
            
        end
        
        function stride_index = getStrideIndexByTime(app, step_time, time_data)
            
            stride_index = zeros(length(step_time),1);
            for index_i = 1:length(step_time)
                index_all = find(time_data >= step_time(index_i));
                stride_index(index_i) = index_all(1);
            end
            
        end
    
        function  data_process = processData(app, stride_index_temp, time_temp, data_temp)
            
            data_temp = double(data_temp);
            
            data_process.origin = data_temp;
            
            if length(time_temp) ~= length(data_temp)
                errordlg('data length is unequal','error');
                return
            end
            
            time  = time_temp;
            stride_index = stride_index_temp;
            num = length(stride_index);
            num = num - 1;
            data_stride = [];
            stride_percent = 0:0.001:1;
            data_stride_pos = zeros(num,length(stride_percent));
            data_stride_neg = zeros(num,length(stride_percent));
            
            
            for index_i = 1:num
                data_interp = interp1((time(stride_index(index_i):stride_index(index_i+1))-time(stride_index(index_i)))/(time(stride_index(index_i+1))-time(stride_index(index_i))),data_temp(stride_index(index_i):stride_index(index_i+1)),stride_percent);
                data_stride = [data_stride;data_interp];
                index_pos = find(data_interp>0);
                index_neg = find(data_interp<0);
                data_stride_pos(index_i,index_pos) = data_interp(index_pos);
                data_stride_neg(index_i,index_neg) = data_interp(index_neg);
            end
            
            data_process.stride.each = data_stride;
            data_process.stride.mean = mean(data_stride,1);
            if num == 1
                data_process.stride.std = zeros(1,length(stride_percent));
            else
                data_process.stride.std = std(data_stride,1);
            end
            
            rms_feature = rms(data_stride,2)';
            data_process.rms.each = rms_feature;
            data_process.rms.mean = mean(rms_feature);
            data_process.rms.std = std(rms_feature);
            data_process.rms.max = max(rms_feature);
            data_process.rms.min = min(rms_feature);
            
%             mean_feature = mean(abs(data_stride),2)';
            mean_feature = mean(data_stride,2)';
            data_process.mean.each = mean_feature;
            data_process.mean.mean = mean(mean_feature);
            data_process.mean.std = std(mean_feature);
            data_process.mean.max = max(mean_feature);
            data_process.mean.min = min(mean_feature);
            
            max_feature = max(data_stride')';
            data_process.max.each = max_feature;
            data_process.max.mean = mean(max_feature);
            data_process.max.std = std(max_feature);
            data_process.max.max = max(max_feature);
            data_process.max.min = min(max_feature);
            
            min_feature = min(data_stride')';
            data_process.min.each = min_feature;
            data_process.min.mean = mean(min_feature);
            data_process.min.std = std(min_feature);
            data_process.min.max = max(min_feature);
            data_process.min.min = min(min_feature);
            
            [~,peaktime_feature] = max(data_stride(:,100:900)');
            peaktime_feature = peaktime_feature'/10+10;
            data_process.pt.each = peaktime_feature;
            data_process.pt.mean = mean(peaktime_feature);
            data_process.pt.std = std(peaktime_feature);
            data_process.pt.max = max(peaktime_feature);
            data_process.pt.min = min(peaktime_feature);
            
            mean_Pushoff = mean(data_stride(:,300:600)');
            data_process.meanP.each = mean_Pushoff;
            data_process.meanP.mean = mean(mean_Pushoff);
            data_process.meanP.std = std(mean_Pushoff);
            data_process.meanP.max = max(mean_Pushoff);
            data_process.meanP.min = min(mean_Pushoff);
            
            max_Pushoff = max(data_stride(:,300:600)');
            data_process.maxP.each = max_Pushoff;
            data_process.maxP.mean = mean(max_Pushoff);
            data_process.maxP.std = std(max_Pushoff);
            data_process.maxP.max = max(max_Pushoff);
            data_process.maxP.min = min(max_Pushoff);
            
            pos_mean_feature = mean(data_stride_pos,2)';
            data_process.pos_mean.each = pos_mean_feature;
            data_process.pos_mean.mean = mean(pos_mean_feature);
            data_process.pos_mean.std = std(pos_mean_feature);
            data_process.pos_mean.max = max(pos_mean_feature);
            data_process.pos_mean.min = min(pos_mean_feature);
            
            neg_mean_feature = mean(data_stride_neg,2)';
            data_process.neg_mean.each = neg_mean_feature;
            data_process.neg_mean.mean = mean(neg_mean_feature);
            data_process.neg_mean.std = std(neg_mean_feature);
            data_process.neg_mean.max = max(neg_mean_feature);
            data_process.neg_mean.min = min(neg_mean_feature);
              
        end
        
        function reArrayPredSimData(app, data_name)
            
            eval(['grf_r = app.data.' data_name '.grf_y_r.origin;']);
            eval(['name_temp = app.data.' data_name '.name;']);
            split_index = 1;
            
            for i = 1:length(grf_r)-5
                if grf_r(i) <= 10 && grf_r(i+5) >= 45
                    split_index = i - floor(length(grf_r)/50);
                    if split_index < 1
                        split_index = 1;
                    end
                    break;
                end
            end
            
            for i = 1:length(name_temp)
                if ~strcmp(name_temp(i), 'time')
                    eval(['app.data.' data_name '.' char(name_temp(i)) '.origin = app.data.' data_name '.' char(name_temp(i)) '.origin([split_index:end, 1:split_index-1]);']);
                end
            end
            
        end
        
        function upColorMap(app)
            
            colorname = app.ColorMapDropDown.Value;
            colordata = app.othercolor(colorname,0);
            x = [0; 0; 10; 10];
            y = [0; 1;  1;  0];
            axis(app.ColorMapAxes,[0,10,0,1]);
            colormap(app.ColorMapAxes, colordata);
            c = [0,0,1,1];
            patch(app.ColorMapAxes,x,y,c);
            
        end
        
        function c = othercolor(app, name, len)
            
            colordata = app.setting.ColorData;
            
            if isempty(fieldnames(colordata))
                c = [];
            else
                if len <= 0
                    c = colordata.(name);
                else
                    c = interp1(linspace(0,1,size(colordata.(name),1)),colordata.(name),linspace(0,1,len),'PCHIP');
                    c(c<0) = 0;
                    c(c>1) = 1;
                end
            end
            
        end
        
        function moveui(app,uiname,x,y,speedx,speedy)
            
            
            pos_x_this = 0;
            pos_y_this = 0;
            dir_x = 1;
            dir_y = 1;
            
            eval(['pos_x_this = ' uiname '.Position(1);']);
            eval(['pos_y_this = ' uiname '.Position(2);']);
            
            if pos_x_this > x
                dir_x = -1;
            end
            if pos_y_this > y
                dir_y = -1;
            end
            
            while (pos_x_this ~= x) || pos_y_this ~= y
                if pos_x_this ~= x
                    if abs(pos_x_this-x) <= speedx
                        pos_x_this = x;
                    else
                        pos_x_this = pos_x_this + dir_x*speedx;
                    end
                end
                if pos_y_this ~= y
                    if abs(pos_y_this-y) <= speedy
                        pos_y_this = y;
                    else
                        pos_y_this = pos_y_this + dir_y*speedy;
                    end
                end
                eval([uiname '.Position(1) = pos_x_this;']);
                eval([uiname '.Position(2) = pos_y_this;']);
                pause(0.02)
%                 disp(pos_y_this);
            end
        end
        
        
        function SetBackGroundSolor(app,Colors)
            app.setting.backcolorset.defult = Colors;
            % 1
            app.MainTab.BackgroundColor = Colors(1,:);
            app.AnaDataTab.BackgroundColor = Colors(1,:);
            app.GlobalSetTab.BackgroundColor = Colors(1,:);
            app.BACKButton_2.BackgroundColor = Colors(1,:);
            
            app.ToolButtonGroup.BackgroundColor = Colors(1,:);
            for i = 1:length(app.ToolButtonGroup.Children)
                app.ToolButtonGroup.Children(i).BackgroundColor = Colors(1,:);
            end
            app.LoadTabButton.BackgroundColor = Colors(2,:);
            app.PlotButtonGroup.BackgroundColor = Colors(1,:);
            for i = 1:length(app.PlotButtonGroup.Children)
                app.PlotButtonGroup.Children(i).BackgroundColor = Colors(1,:);
            end
            app.PLOTButton.BackgroundColor = Colors(2,:);
            for i = 1:length(app.ToolTabGroup.Children)
                if isprop(app.ToolTabGroup.Children(i),'BackgroundColor')
                    app.ToolTabGroup.Children(i).BackgroundColor = Colors(2,:);
                end
                for j = 1:length(app.ToolTabGroup.Children(i).Children)
                    if isprop(app.ToolTabGroup.Children(i).Children(j),'BackgroundColor')
                        app.ToolTabGroup.Children(i).Children(j).BackgroundColor = Colors(2,:);
                    end
                end
            end
            for i = 1:length(app.PlotGroup.Children)
                if isprop(app.PlotGroup.Children(i),'BackgroundColor')
                    app.PlotGroup.Children(i).BackgroundColor = 0.5*Colors(1,:)+0.5*Colors(2,:);
                end
                for j = 1:length(app.PlotGroup.Children(i).Children)
                    if isprop(app.PlotGroup.Children(i).Children(j),'BackgroundColor')
                        app.PlotGroup.Children(i).Children(j).BackgroundColor = Colors(2,:);
                    end
                    for k = 1:length(app.PlotGroup.Children(i).Children(j).Children)
                        if isprop(app.PlotGroup.Children(i).Children(j).Children(k),'BackgroundColor')
                            app.PlotGroup.Children(i).Children(j).Children(k).BackgroundColor = Colors(2,:);
                        end
                    end
                end
            end
            app.BACKButton.BackgroundColor = Colors(1,:);
            app.SearchButton.BackgroundColor = Colors(1,:);
            app.ListButton.BackgroundColor = Colors(2,:);
            app.Panel_3.BackgroundColor = Colors(1,:);
            app.Panel_2.BackgroundColor = Colors(1,:);
            
            app.ProcessAnalysisButton.BackgroundColor = Colors(2,:);
            app.GlobalSettingButton.BackgroundColor = Colors(2,:);
            app.LoadTabButton.BackgroundColor = Colors(2,:);
            
            app.DataListBox.BackgroundColor = Colors(3,:);
            app.KeyVariableListBox.BackgroundColor = Colors(3,:);
            app.VariableListBox.BackgroundColor = Colors(3,:);
            app.DataListBox.FontColor = Colors(4,:);
            app.KeyVariableListBox.FontColor = Colors(4,:);
            app.VariableListBox.FontColor = Colors(4,:);
            
            app.ClassListBox.BackgroundColor = Colors(3,:);
            app.GroupListBox.BackgroundColor = Colors(3,:);
            app.GroupDataListBox.BackgroundColor = Colors(3,:);
            app.ClassListBox.FontColor = Colors(4,:);
            app.GroupListBox.FontColor = Colors(4,:);
            app.GroupDataListBox.FontColor = Colors(4,:);
            

        end
        
        function processOneVar(app, data_name, var_name)

            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            
            data_name_split = strsplit(data_name,'.');
            eval(['name_temp = app.data.' data_name '.name;']);
            
            if strcmp(data_name_split{1}, 'dspace')
                if ismember(1,strcmp(name_temp, 'state'))
                    
                    eval(['state_data = app.data.' data_name '.state.origin;']);
                    eval(['data_time = app.data.' data_name '.time.origin;']);
                    stride_index = app.getStrideIndexByState(state_data);
                    
                    eval(['data_temp = app.data.' data_name '.' var_name '.origin;']);
                    eval(['app.data.' data_name '.' var_name ' = app.processData(stride_index, data_time, data_temp);']);
                    
                elseif ismember(1,strcmp(name_temp, 'state_r')) && ismember(1,strcmp(name_temp, 'state_l'))
                    
                    eval(['state_r_data = app.data.' data_name '.state_r.origin;']);
                    eval(['state_l_data = app.data.' data_name '.state_l.origin;']);
                    eval(['data_time = app.data.' data_name '.time.origin;']);
                    stride_r_index = app.getStrideIndexByState(state_r_data);
                    stride_l_index = app.getStrideIndexByState(state_l_data);
                    
                    if length(stride_l_index) < 10
                        
                        eval(['data_temp = app.data.' data_name '.' var_name '.origin;']);
                        eval(['app.data.' data_name '.' var_name ' = app.processData(stride_r_index, data_time, data_temp);']);
                    
                    elseif length(stride_r_index) < 10
                        
                        eval(['data_temp = app.data.' data_name '.' var_name '.origin;']);
                        eval(['app.data.' data_name '.' var_name ' = app.processData(stride_l_index, data_time, data_temp);']);
                        
                    else
                        if contains(var_name,'_r') || contains(var_name,'_R')
                            eval(['data_temp = app.data.' data_name '.' var_name '.origin;']);
                            eval(['app.data.' data_name '.' var_name ' = app.processData(stride_r_index, data_time, data_temp);']);
                        elseif contains(var_name,'_l') || contains(var_name,'_L')
                            eval(['data_temp = app.data.' data_name '.' var_name '.origin;']);
                            eval(['app.data.' data_name '.' var_name ' = app.processData(stride_l_index, data_time, data_temp);']);
                        else
                            eval(['data_temp = app.data.' data_name '.' var_name '.origin;']);
                            eval(['app.data.' data_name '.' var_name ' = app.processData(stride_r_index, data_time, data_temp);']);
                        end
                    end
                else
                    errordlg('no state variable','error');
                    return
                end
            end
            
        end
    end


    % Callbacks that handle component events
    methods (Access = private)

        % Code that executes after component creation
        function startupFcn(app)
            
            % 初始化数据结构
            app.data = struct;
            app.data.name = {};
            app.data.comp.name = {};
            app.data.groupbar.class.name = {};
            app.data.groupbar.group.name = {};
            app.data.fit.name = {};
            app.data.fit.value = {};
            app.data.fit.labelX = {};
            app.data.fit.labelY = {};
            app.data.fit.selectedRow = 1;
            app.data.sig.name = {};
            app.data.sig.selectedGroup = [];
            
            
            % 获得屏幕分辨率
            ss = get(0,'ScreenSize');
            app.setting.screen = ss(3:4);
            % 设置显示位置
            app.DPAS102LabUIFigure.Position = [app.setting.screen(1)-1080 app.setting.screen(2)-750 1080 720];
            
            
            % 定义初始颜色
            app.setting.usercolor = [0 0.45 0.74];
            % 加载othercolor配色方案
            app.setting.ColorData = load('colorData.mat');
            ColorName = load('colorName.mat');
            app.setting.ColorName = ColorName.ColorName;
            app.setting.ColorIndex = 0;
            app.Lamp.BackgroundColor = app.setting.usercolor;
            
             % 设置配色选择框
            app.ColorMapDropDown.Items = ColorName.ColorName;
            app.upColorMap();
            
            % 设置背景颜色
            app.setting.backcolorset = {};
            app.setting.backcolorset.defult = [0.15,0.15,0.15; 0.25,0.25,0.25; 0.50,0.50,0.50; 1 1 1];
            app.setting.backcolorset.dark = [0.15,0.15,0.15; 0.25,0.25,0.25; 0.50,0.50,0.50; 1 1 1];
            app.setting.backcolorset.blue = [0.4627    0.6235    0.8039; 0.5941    0.7333    0.8607; 0.8392    0.9020    0.9490; 0 0 0];
            app.setting.backcolorset.green = [0.3216    0.4510    0.3020;0.5686    0.7804    0.5333;0.8667    1.0000    0.7373; 0 0 0];
            app.setting.backcolorset.pink = [0.9725    0.6314    0.8196;0.8941    0.7294    0.8314;0.9647    0.8745    0.9216; 0 0 0];
            app.setting.backcolorset.purple = [0.4980    0.4706    0.8235; 0.6510    0.6941    0.8824; 0.8627    0.8392    0.9686; 0 0 0];
            app.SetBackGroundSolor(app.setting.backcolorset.dark);
            
            
            % 调整各模块位置
            app.Panel_2.Position = [35,-520,220,480];
            app.Panel_3.Position = [25,30,220,480];
            
            app.Lamp.BackgroundColor = app.setting.usercolor;
            
        end

        % Value changed function: ProcessAnalysisButton
        function ProcessAnalysisButtonValueChanged(app, event)
            
            % 进入数据分析界面
            app.TabGroup.SelectedTab = app.AnaDataTab;
            
        end

        % Button pushed function: BACKButton, BACKButton_2
        function BACKButtonPushed(app, event)
            
            % 返回主界面
            app.TabGroup.SelectedTab = app.MainTab;
            
        end

        % Callback function
        function LOADButtonPushed(app, event)
            
            % 进入数据加载界面
            app.moveui('app.Panel_2',35,-520,10,200);
            app.moveui('app.Panel_3',35,30,10,200);
            app.moveui('app.Panel_5',1080,590,200,10);
            app.moveui('app.Panel_6',1080,590,200,10);
            app.moveui('app.Panel_4',296,590,200,10);
        end

        % Button pushed function: PLOTButton
        function PLOTButtonPushed(app, event)
            
            % 进入绘图界面
%             app.moveui('app.Panel_3',35,-520,10,200);
%             app.moveui('app.Panel_8',276,-576,10,200);
%             app.moveui('app.Panel_12',276,-576,10,200);
%             app.moveui('app.Panel_13',276,-576,10,200);
% %             app.moveui('app.Panel_2',35,30,10,200);
%             app.moveui('app.Panel_7',276,2,10,200);
%             app.moveui('app.Panel_4',1080,590,200,10);
%             app.moveui('app.Panel_6',1080,590,200,10);
%             app.moveui('app.Panel_5',296,590,200,10);
            for i = 1:length(app.PlotButtonGroup.Children)
                app.PlotButtonGroup.Children(i).BackgroundColor = app.setting.backcolorset.defult(1,:);
            end
            app.PLOTButton.BackgroundColor = app.setting.backcolorset.defult(2,:);
            
            app.PlotGroup.SelectedTab = app.PlotTab;
            app.DataListBox.Items = app.data.name;
            app.updateKeyVarTable();
            
        end

        % Button pushed function: LOADDATAButton
        function LOADDATAButtonPushed(app, event)
            
            % 进入数据类型选择界面 app.Panel_4_3
%             app.moveui('app.Panel_4_3',326,590,100,10);
            app.ToolTabGroup.SelectedTab = app.DataTypeTab;
            
        end

        % Value changed function: dSPACEButton
        function dSPACEButtonValueChanged(app, event)
            
            % 返回并读取dSPACE数据
            app.ToolTabGroup.SelectedTab = app.LoadTab;
            app.loadDspaceData();
            
        end

        % Value changed function: OpenSimButton
        function OpenSimButtonValueChanged(app, event)
            
            % 返回并读取OpenSim数据
            app.ToolTabGroup.SelectedTab = app.LoadTab;
            app.loadOpenSimData();
            
        end

        % Value changed function: PredSimButton
        function PredSimButtonValueChanged(app, event)
            
            % 返回并读取PredSim数据
            app.ToolTabGroup.SelectedTab = app.LoadTab;
            app.loadPredSimData();
            
        end

        % Value changed function: SCONEButton
        function SCONEButtonValueChanged(app, event)
            
            % 返回并读取Scone数据
            app.ToolTabGroup.SelectedTab = app.LoadTab;
            app.loadSconeData();
            
        end

        % Value changed function: HistoryButton
        function HistoryButtonValueChanged(app, event)
            
            app.ToolTabGroup.SelectedTab = app.LoadTab;
            app.loadHistory();
            
        end

        % Callback function
        function DataListBoxValueChanged(app, event)
            
            app.updateVarTable();
            
        end

        % Button pushed function: DELETEDATAButton
        function DELETEDATAButtonPushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            
            if ~isempty(data_name) && ~strcmp(data_name,'NULL')
            
                for i = 1:length(app.data.name)
                    if strcmp(app.data.name(i),data_name)
                        app.data.name(i) = [];
                        break;
                    end
                end
                
                data_name = strsplit(data_name,'.');
                
                eval(['app.data.' data_name{1} ' = rmfield(app.data.' data_name{1} ', ''' data_name{2} ''');']);
                
                app.DataListBox.Items = app.data.name;
                app.updateVarTable();
            end
            
        end

        % Button pushed function: SAVEVARButton
        function SAVEVARButtonPushed(app, event)
            [file, path]=uiputfile('AnaData.mat','Save data name');
            data = app.data;
            if ~(isequal(file,0))  
                save(fullfile(path, file),'data');
            end
        end

        % Button pushed function: PROCESSButton
        function PROCESSButtonPushed(app, event)
            
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            
            data_name_split = strsplit(data_name,'.');
            eval(['name_temp = app.data.' data_name '.name;']);
            
            if strcmp(data_name_split{1}, 'dspace')
                if ismember(1,strcmp(name_temp, 'state'))
                    eval(['state_data = app.data.' data_name '.state.origin;']);
                    eval(['data_time = app.data.' data_name '.time.origin;']);
                    stride_index = app.getStrideIndexByState(state_data);
                    for i = 1:length(name_temp)
                        app.VariableListBox.Value = name_temp(i);pause(0.01);
                        eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                        eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_index, data_time, data_temp);']);
                    end
                elseif ismember(1,strcmp(name_temp, 'state_r')) && ismember(1,strcmp(name_temp, 'state_l'))
                    eval(['state_r_data = app.data.' data_name '.state_r.origin;']);
                    eval(['state_l_data = app.data.' data_name '.state_l.origin;']);
                    eval(['data_time = app.data.' data_name '.time.origin;']);
                    stride_r_index = app.getStrideIndexByState(state_r_data);
                    stride_l_index = app.getStrideIndexByState(state_l_data);
                    if length(stride_l_index) < 10
                        for i = 1:length(name_temp)
                            app.VariableListBox.Value = name_temp(i);pause(0.01);
                            eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                            eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_r_index, data_time, data_temp);']);
                        end
                    elseif length(stride_r_index) < 10
                        for i = 1:length(name_temp)
                            app.VariableListBox.Value = name_temp(i);pause(0.01);
                            eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                            eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_l_index, data_time, data_temp);']);
                        end
                    else
                        for i = 1:length(name_temp)
                            if ~isempty(strfind(name_temp{i},'_r')) || ~isempty(strfind(name_temp{i},'_R'))
                                app.VariableListBox.Value = name_temp(i);pause(0.01);
                                eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                                eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_r_index, data_time, data_temp);']);
                            elseif ~isempty(strfind(name_temp{i},'_l')) || ~isempty(strfind(name_temp{i},'_L'))
                                app.VariableListBox.Value = name_temp(i);pause(0.01);
                                eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                                eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_l_index, data_time, data_temp);']);
                            else
                                app.VariableListBox.Value = name_temp(i);pause(0.01);
                                eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                                eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_r_index, data_time, data_temp);']);
                            end
                        end
                    end
                else
                    errordlg('no state variable','error');
                    return
                end
            elseif strcmp(data_name_split{1}, 'opensim')
                [file,path,indx] = uigetfile('*.mat','Select the Step Initial Time file (contain a step variable)');
                if indx == 1
                    Step = load(fullfile(path, file));
                    if isfield(Step,'step')
                        step_initial_time = Step.step;
                        eval(['data_time = app.data.' data_name '.time.origin;']);
                        stride_index = app.getStrideIndexByTime(step_initial_time, data_time);
                        for i = 1:length(name_temp)
                            eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                            eval(['app.data.' data_name '.' name_temp{i} ' = app.processData(stride_index, data_time, data_temp);']);
                        end
                    else
                        errordlg('no step variable','error');
                    end
                end
            elseif strcmp(data_name_split{1}, 'predsim')
                app.reArrayPredSimData(data_name);
                eval(['data_time = app.data.' data_name '.time.origin;']);
                stride_index = [1,length(data_time)];
                for i = 1:length(name_temp)
                    eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                    eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_index, data_time, data_temp);']);
                end
            elseif strcmp(data_name_split{1}, 'scone')
                if ismember(1,strcmp(name_temp, 'exp_stride_state_r'))
                    eval(['state_data = app.data.' data_name '.exp_stride_state_r.origin;']);
                    eval(['data_time = app.data.' data_name '.time.origin;']);
                    stride_index = app.getStrideIndexByState(state_data);   
                    for i = 1:length(name_temp)
                        eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                        eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_index, data_time, data_temp);']);
                    end
                else
                    errordlg('no exp_stride_state_r variable','error');
                    return
                end
            else
                errordlg('error data form','error');
                return
            end
            
            eval(['app.data.' data_name '.processFlag = true;']);
            app.updateVarTable();
            msgbox('Process Completed');
            
        end

        % Button pushed function: DivideDataButton
        function DivideDataButtonPushed(app, event)
            
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            data_name_split = strsplit(data_name,'.');
            eval(['max_time = app.data.' data_name '.time.origin(end);']);
            
            if strcmp(data_name_split{1}, 'dspace')
                last_time = str2double(inputdlg(['Input how long time(s) needed to divide(max ' num2str(floor(max_time)) ')：'],'Divide Data'));
                if ~isempty(last_time)
                    eval(['divide_list = find(app.data.' data_name '.time.origin-last_time > 0);']);
                    if ~isempty(divide_list)
                        
                        divide_index = divide_list(1);
                        
                        new_name = [data_name '_last' num2str(last_time)];
                        app.data.name(end+1) = {new_name};
                        app.DataListBox.Items = app.data.name;
                        
                        eval(['app.data.' new_name ' = app.data.' data_name ';']);
                        eval(['name_temp = app.data.' new_name '.name;']);
                        for i = 1:length(name_temp)
                            eval(['app.data.' new_name '.' char(name_temp(i)) '.origin = app.data.' new_name '.' char(name_temp(i)) '.origin(divide_index:end);']);
                        end
                        
                        eval(['app.data.' new_name '.processFlag = false;']);
                        app.updateVarTable();
                        
                    end
                end
            end
            
        end

        % Button pushed function: MergeDataButton
        function MergeDataButtonPushed(app, event)
           
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) < 1
                return;
            end
            
            new_name = 'dspace.Merge_';
            merge_num = size(data_name,1);
            cut_list = zeros(merge_num,2);
            
            %% 本版本未加入数据的变量一致性检验，需注意
            
            for i = 1:merge_num
                eval(['name_temp = app.data.' data_name(i,:) '.name;']);
                if ismember(1,strcmp(name_temp, 'state'))
                    eval(['state_data = app.data.' data_name(i,:) '.state.origin;']);
                elseif ismember(1,strcmp(name_temp, 'state_r'))
                    eval(['state_data = app.data.' data_name(i,:) '.state_r.origin;']);
                else
                    errordlg(['no state variable in ' data_name(i,:)],'error');
                    return
                end
                stance_index = find(state_data(2:end) - state_data(1:end-1) == 1) + 1;
                cut_list(i,1) = stance_index(1);cut_list(i,2) = stance_index(end)-1;
            end
            
            for i = 1:merge_num-1
                data_name_split = strsplit(data_name(i,:),'.');
                new_name = [new_name data_name_split{2} '_'];
            end
            
            data_name_split = strsplit(data_name(end,:),'.');
            new_name = [new_name data_name_split{2}];
            
            app.data.name(end+1) = {new_name};
            app.DataListBox.Items = app.data.name;
                        
            eval(['app.data.' new_name ' = app.data.' data_name(1,:) ';']);
            eval(['name_temp = app.data.' new_name '.name;']);
            for i = 1:length(name_temp)
                eval(['app.data.' new_name '.' char(name_temp(i)) '.origin = [];']);
                for j = 1:merge_num
                    eval(['app.data.' new_name '.' char(name_temp(i)) '.origin = [app.data.' new_name '.' char(name_temp(i)) '.origin, app.data.' data_name(j,:) '.' char(name_temp(i)) '.origin(cut_list(j,1):cut_list(j,2))];']);
                end
            end
            
            %% process time data separately
            eval(['app.data.' new_name '.time.origin = app.data.' data_name(1,:) '.time.origin(cut_list(1,1):cut_list(1,2));']);
            for j = 2:merge_num
                eval(['app.data.' new_name '.time.origin = [app.data.' new_name '.time.origin, app.data.' new_name '.time.origin(end) + app.data.' data_name(j,:) '.time.origin(cut_list(j,1):cut_list(j,2)) - app.data.' data_name(j,:) '.time.origin(cut_list(j,1)-1)];']);
            end
            
            eval(['app.data.' new_name '.processFlag = false;']);
            app.updateVarTable();
            
            
        end

        % Button pushed function: DelVarButton
        function DelVarButtonPushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            
            var_name = char(app.VariableListBox.Value);
            
            if ~isempty(data_name) && ~isempty(var_name)
                eval(['name_temp = app.data.' data_name '.name;']);
                
                eval(['app.data.' data_name ' = rmfield(app.data.' data_name ', ''' var_name ''');']);
                for i = 1:length(name_temp)
                    if strcmp(name_temp{i}, var_name)
                        name_temp(i) = [];
                        break;
                    end
                end
                
                eval(['app.data.' data_name '.name = name_temp;']);
                app.updateVarTable();
            end
        end

        % Button pushed function: RenameVarButton
        function RenameVarButtonPushed(app, event)
            data_name = char(app.DataListBox.Value);
%             if size(data_name,1) > 1
%                 data_name = data_name(1,:);
%             end
            
            var_name = char(app.VariableListBox.Value);
            
            if ~isempty(data_name) && ~isempty(var_name)
                eval(['name_temp = app.data.' data_name '.name;']);
                new_var_name = char(inputdlg('Input new variable name：','Rename'));
                if size(data_name,1) == 1
                    if ismember(1,strcmp(name_temp,new_var_name))
                        errordlg('input name has existed','error');
                        return;
                    end
                    eval(['app.data.' data_name '.' new_var_name ' = app.data.' data_name '.' var_name ';']);
                    eval(['app.data.' data_name ' = rmfield(app.data.' data_name ', ''' var_name ''');']);
                    for i = 1:length(name_temp)
                        if strcmp(name_temp{i}, var_name)
                            name_temp(i) = {new_var_name};
                            break;
                        end
                    end
                    
                    eval(['app.data.' data_name '.name = name_temp;']);
                else
                    for i = 1:size(data_name,1)
                        if ismember(1,strcmp(name_temp,new_var_name))
                            errordlg('input name has existed','error');
                            return;
                        end
                        eval(['app.data.' data_name(i,:) '.' new_var_name ' = app.data.' data_name(i,:) '.' var_name ';']);
                        eval(['app.data.' data_name(i,:) ' = rmfield(app.data.' data_name(i,:) ', ''' var_name ''');']);
                        for i = 1:length(name_temp)
                            if strcmp(name_temp{i}, var_name)
                                name_temp(i) = {new_var_name};
                                break;
                            end
                        end
                        
                        eval(['app.data.' data_name(i,:) '.name = name_temp;']);
                    end
                end
                    app.updateVarTable();
                
            end
        end

        % Button pushed function: NormalVarButton
        function NormalVarButtonPushed(app, event)
            data_name = char(app.DataListBox.Value);
%             if size(data_name,1) > 1
%                 data_name = data_name(1,:);
%             end
            
            var_name = char(app.VariableListBox.Value);
            
            if ~isempty(data_name) && ~isempty(var_name)
                normal_gain = str2double(inputdlg(['Input normalization gain：'],'Normalization'));
                if isnumeric(normal_gain)
                    if ~isempty(normal_gain) && ~isnan(normal_gain)
                        if size(data_name,1) == 1
                            eval(['app.data.' data_name '.' var_name '.origin = normal_gain * app.data.' data_name '.' var_name '.origin;']);
                            app.processOneVar(data_name,var_name);
                        else
                            for i = 1:size(data_name,1)
                                eval(['app.data.' data_name(i,:) '.' var_name '.origin = normal_gain * app.data.' data_name(i,:) '.' var_name '.origin;']);
                                app.processOneVar(data_name(i,:), var_name);
                            end
                        end
                        msgbox('Process Completed');
                        return
                    end
                end
            end
            msgbox('No Processing');
            
        end

        % Button pushed function: BiasVarButton
        function BiasVarButtonPushed(app, event)
            
            data_name = char(app.DataListBox.Value);      
            var_name = char(app.VariableListBox.Value);
            
            if ~isempty(data_name) && ~isempty(var_name)
                bias = str2double(inputdlg(['Input calibration bias：'],'Calibration'));
                if isnumeric(bias)
                    if ~isempty(bias) && ~isnan(bias)
                        if size(data_name,1) == 1
                            eval(['app.data.' data_name '.' var_name '.origin = app.data.' data_name '.' var_name '.origin - bias;']);
                            app.processOneVar(data_name,var_name);
                        else
                            for i = 1:size(data_name,1)
                                eval(['app.data.' data_name(i,:) '.' var_name '.origin = app.data.' data_name(i,:) '.' var_name '.origin - bias;']);
                                app.processOneVar(data_name(i,:), var_name);
                            end
                        end
                        msgbox('Process Completed');
                        return
                    end
                end
            end
            msgbox('No Processing');
            
        end

        % Value changed function: DataListBox
        function DataListBoxValueChanged2(app, event)
            
            app.updateKeyVarTable();
            app.updateVarTable();
            
            
        end

        % Value changed function: EditKey
        function EditKeyValueChanged(app, event)
            
            app.updateKeyVarTable();
            
        end

        % Callback function
        function NEWButtonPushed(app, event)
            figure('position',[0,515,800,480]);
            app.userfig = subplot(1,1,1);
            xlabel('Time(s)');
            legend('show');
            hleg = legend('boxoff');
            set(hleg,'Interpreter','none')
            hold on;
            h = gca;
            h.Box = 'off';
            h.FontName = 'Times New Roman';
            h.FontSize = 14;
            h = gcf;
            h.Color = [1,1,1];
        end

        % Callback function
        function NEWButton_2Pushed(app, event)
            figure('position',[0,515,800,480]);
            app.userfig = gca;
            xlabel('Stride Num(n)');
            legend('show');
            hleg = legend('boxoff');
            set(hleg,'Interpreter','none')
            hold on;
            h = gca;
            h.Box = 'off';
            h.FontName = 'Times New Roman';
            h.FontSize = 14;
            h = gcf;
            h.Color = [1,1,1];
        end

        % Callback function
        function NEWButton_3Pushed(app, event)
            figure('position',[0,515,800,480]);
            app.userfig = gca;
            xlabel('Stride Percent(%)');
%             legend('show');
%             hleg = legend('boxoff');
%             set(hleg,'Interpreter','none')
            hold on;
            h = gca;
            h.Box = 'off';
            h.FontName = 'Times New Roman';
            h.FontSize = 14;
            h = gcf;
            h.Color = [1,1,1];
        end

        % Callback function
        function NEWButton_4Pushed(app, event)
            % Add you code here
        end

        % Callback function
        function CLEARButtonPushed(app, event)
            
            if ~isempty(app.userfig)
                cla(app.userfig);
            end
            
        end

        % Callback function
        function SETCOLORButtonPushed(app, event)
            app.setting.usercolor = uisetcolor(app.setting.usercolor);
            app.Lamp.BackgroundColor = app.setting.usercolor;
        end

        % Callback function
        function ADDButtonPushed(app, event)
            % Add you code
        end

        % Callback function
        function DELButtonPushed(app, event)
            % Add you code
        end

        % Callback function
        function PLOTButton_2Pushed(app, event)
            
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.KeyVariableListBox.Value);
            
            if isempty(app.userfig)
                errordlg('Please create a new figure','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please select a variable','error');
            else
                eval(['plot(app.userfig, app.data.' data_name '.time.origin, app.data.' data_name '.' var_name '.origin,''LineWidth'',1,''DisplayName'',''' var_name ''');']);
            end
            
        end

        % Callback function
        function PLOTButton_3Pushed(app, event)
            
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.KeyVariableListBox.Value);
            eval(['processflag = app.data.' data_name '.processFlag;']);
            
            feature_name = app.FeatureDropDown.Value;
            
            if ~processflag
                errordlg('Please process data first','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            elseif isempty(var_name)
                errordlg('Please select a variable','error');
            else 
                eval(['plot(app.userfig, app.data.' data_name '.' var_name '.' feature_name '.each,''LineWidth'',1,''DisplayName'',''' var_name '_' feature_name ''');']);
            end
                
        end

        % Callback function
        function PLOTButton_4Pushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.KeyVariableListBox.Value);
            stride_percent = 0:0.1:100;
            
            eval(['processflag = app.data.' data_name '.processFlag;']);
            
            if ~processflag
                errordlg('Please process data first','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            elseif isempty(var_name)
                errordlg('Please select a variable','error');
            else
                eval(['data_temp =   app.data.' data_name '.' var_name '.stride;']);
                
                % 数据反向处理
                if app.ReverseCheckBox.Value == 1
                    data_each = -data_temp.each;
                    data_mean = -data_temp.mean;
                    data_std  = -data_temp.std;
                else
                    data_each = data_temp.each;
                    data_mean = data_temp.mean;
                    data_std  = data_temp.std;
                end
                
                % 绘制每条轨迹
                if app.eachCheckBox.Value == 1
                    userAlpha = 0.6;
                    for j = 1:length(data_each(:,1))
                        plot(app.userfig, stride_percent, data_each(j,:),'-','color',1.0 - userAlpha*(1.0 - app.setting.usercolor), 'EraseMode', 'xor','LineWidth',0.5);
                    end
                end
                % 绘制误差区域
                if app.stdCheckBox.Value == 1
                    h = area(app.userfig, stride_percent,[data_mean' - data_std', 2 * data_std']);
                    set(h(1),'Visible','off');
                    set(h(2),'EdgeColor','none','FaceColor',app.setting.usercolor,'FaceAlpha',0.4,'ShowBaseLine','off');
                end
                % 绘制平均曲线
                if app.meanCheckBox.Value == 1
                    plot(app.userfig, stride_percent, data_mean','color',app.setting.usercolor,'LineWidth',2);
                end
            end
            
        end

        % Button pushed function: PROCESSALLButton
        function PROCESSALLButtonPushed(app, event)
            
            for data_index = 1:length(app.data.name)
                
                data_name = app.data.name{data_index};
                data_name_split = strsplit(data_name,'.');
                eval(['name_temp = app.data.' data_name '.name;']);
                eval(['processflag = app.data.' data_name '.processFlag;']);
                
                app.DataListBox.Value = {data_name};pause(0.01);
                app.updateVarTable();
                
                if ~processflag
                    
                    if strcmp(data_name_split{1}, 'dspace')
                        if ismember(1,strcmp(name_temp, 'state'))
                            eval(['state_data = app.data.' data_name '.state.origin;']);
                            eval(['data_time = app.data.' data_name '.time.origin;']);
                            stride_index = app.getStrideIndexByState(state_data);
                            for i = 1:length(name_temp)
                                app.VariableListBox.Value = name_temp(i);pause(0.01);
                                eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                                eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_index, data_time, data_temp);']);
                            end
                        elseif ismember(1,strcmp(name_temp, 'state_r')) && ismember(1,strcmp(name_temp, 'state_l'))
                            eval(['state_r_data = app.data.' data_name '.state_r.origin;']);
                            eval(['state_l_data = app.data.' data_name '.state_l.origin;']);
                            eval(['data_time = app.data.' data_name '.time.origin;']);
                            stride_r_index = app.getStrideIndexByState(state_r_data);
                            stride_l_index = app.getStrideIndexByState(state_l_data);
                            if length(stride_l_index) < 10
                                for i = 1:length(name_temp)
                                    app.VariableListBox.Value = name_temp(i);pause(0.01);
                                    eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                                    eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_r_index, data_time, data_temp);']);
                                end
                            elseif length(stride_r_index) < 10
                                for i = 1:length(name_temp)
                                    app.VariableListBox.Value = name_temp(i);pause(0.01);
                                    eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                                    eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_l_index, data_time, data_temp);']);
                                end
                            else
                                for i = 1:length(name_temp)
                                    if ~isempty(strfind(name_temp{i},'_r')) || ~isempty(strfind(name_temp{i},'_R'))
                                        app.VariableListBox.Value = name_temp(i);pause(0.01);
                                        eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                                        eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_r_index, data_time, data_temp);']);
                                    elseif ~isempty(strfind(name_temp{i},'_l')) || ~isempty(strfind(name_temp{i},'_L'))
                                        app.VariableListBox.Value = name_temp(i);pause(0.01);
                                        eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                                        eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_l_index, data_time, data_temp);']);
                                    else
                                        app.VariableListBox.Value = name_temp(i);pause(0.01);
                                        eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                                        eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_r_index, data_time, data_temp);']);
                                    end
                                end
                            end
                        else
                            errordlg('no state variable','error');
                            return
                        end
                    elseif strcmp(data_name_split{1}, 'opensim')
                        [file,path,indx] = uigetfile('*.mat','Select the Step Initial Time file (contain a step variable)');
                        if indx == 1
                            Step = load(fullfile(path, file));
                            if isfield(Step,'step')
                                step_initial_time = Step.step;
                                eval(['data_time = app.data.' data_name '.time.origin;']);
                                stride_index = app.getStrideIndexByTime(step_initial_time, data_time);
                                for i = 1:length(name_temp)
                                    eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                                    eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_index, data_time, data_temp);']);
                                end
                            else
                                errordlg('no step variable','error');
                            end
                        end
                    elseif strcmp(data_name_split{1}, 'predsim')
                        app.reArrayPredSimData(data_name);
                        eval(['data_time = app.data.' data_name '.time.origin;']);
                        stride_index = [1,length(data_time)];
                        for i = 1:length(name_temp)
                            eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                            eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_index, data_time, data_temp);']);
                        end
                    elseif strcmp(data_name_split{1}, 'scone')
                        if ismember(1,strcmp(name_temp, 'exp_stride_state_r'))
                            eval(['state_data = app.data.' data_name '.exp_stride_state_r.origin;']);
                            eval(['data_time = app.data.' data_name '.time.origin;']);
                            stride_index = app.getStrideIndexByState(state_data);   
                            for i = 1:length(name_temp)
                                eval(['data_temp = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                                eval(['app.data.' data_name '.' char(name_temp(i)) ' = app.processData(stride_index, data_time, data_temp);']);
                            end
                        else
                            errordlg('no exp_stride_state_r variable','error');
                            return
                        end
                    else
                        errordlg('error data form','error');
                        return
                    end
                    
                    eval(['app.data.' data_name '.processFlag = 1;']);
                    
                end
                
            end
            
            app.updateVarTable();
            msgbox('Process Completed');
            
        end

        % Callback function
        function TIMENEWButtonPushed(app, event)
            figure('position',[0,app.setting.screen(2)-565,800,480]);
            app.userfig = subplot(1,1,1);
            xlabel('Time(s)');
            legend('show');
            hleg = legend('boxoff');
            set(hleg,'Interpreter','none')
            hold on;
            h = gca;
            h.Box = 'off';
            h.FontName = 'Times New Roman';
            h.FontSize = 14;
            h = gcf;
            h.Color = [1,1,1];
            app.userpl = struct;
        end

        % Callback function
        function TIMECLEARButtonPushed(app, event)
            
            if ~isempty(app.userfig)
                cla(app.userfig);
                app.userpl = struct;
            end
            
        end

        % Button pushed function: TIMEPLOTButton
        function TIMEPLOTButtonPushed(app, event)
            
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.VariableListBox.Value);
            linewidth = char(app.LineWidthDropDown.Value);
            linetype = char(app.LineTypeDropDown.Value);
            markersize = char(app.MarkerSizeDropDown.Value);
            markertype = char(app.MarkerTypeDropDown.Value);
            colordata = app.setting.usercolor;
            
            
            if isempty(app.userfig)
                errordlg('Please create a new figure','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please select a variable','error');
            else
                if app.ReverseCheckBox.Value == 1
                    eval(['p = plot(app.userfig, app.data.' data_name '.time.origin, -app.data.' data_name '.' var_name '.origin,''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''Marker'',''' markertype ''',''MarkerSize'',' markersize ',''color'', colordata );']);
                    pl_num = length(fieldnames(app.userpl));
                    eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                else
                    eval(['p = plot(app.userfig, app.data.' data_name '.time.origin, app.data.' data_name '.' var_name '.origin,''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''Marker'',''' markertype ''',''MarkerSize'',' markersize ',''color'', colordata );']);
                    pl_num = length(fieldnames(app.userpl));
                    eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                end
            end   
        end

        % Callback function
        function FEATURENEWButtonPushed(app, event)
            figure('position',[0,app.setting.screen(2)-565,800,480]);
            app.userfig = gca;
            xlabel('Stride Num(n)');
            legend('show');
            hleg = legend('boxoff');
            set(hleg,'Interpreter','none')
            hold on;
            h = gca;
            h.Box = 'off';
            h.FontName = 'Times New Roman';
            h.FontSize = 14;
            h = gcf;
            h.Color = [1,1,1];
            app.userpl = struct;
        end

        % Button pushed function: FEATUREPLOTButton
        function FEATUREPLOTButtonPushed(app, event)
            
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.VariableListBox.Value);
            linewidth = char(app.LineWidthDropDown.Value);
            linetype = char(app.LineTypeDropDown.Value);
            markersize = char(app.MarkerSizeDropDown.Value);
            markertype = char(app.MarkerTypeDropDown.Value);
            colordata = app.setting.usercolor;
            
            eval(['processflag = app.data.' data_name '.processFlag;']);
            
            feature_name = app.FeatureDropDown.Value;
            averagenum = str2num(char(app.AverageDropDown.Value));
            
            if ~processflag
                errordlg('Please process data first','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            elseif isempty(var_name)
                errordlg('Please select a variable','error');
            else
                
                eval(['stride_data = app.data.' data_name '.' var_name '.' feature_name '.each;']);
                stride_data = smooth(stride_data,averagenum);
                
                if app.ReverseCheckBox.Value == 1
                stride_data = -stride_data;
                end
                                
                stride_index = 1:length(stride_data);
                eval(['p = plot(app.userfig, stride_index, stride_data,''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''Marker'',''' markertype ''',''MarkerSize'',' markersize ',''color'', colordata);']);%p = scatter(app.userfig, stride_index, stride_data, sz, c, 'filled','MarkerFaceColor', app.setting.usercolor);
                pl_num = length(fieldnames(app.userpl));
                eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
            end
        end

        % Callback function
        function SETCOLORButtonPushed2(app, event)
            app.setting.usercolor = uisetcolor(app.setting.usercolor);
            app.Lamp.BackgroundColor = app.setting.usercolor;
        end

        % Button pushed function: NEWButton
        function NEWButtonPushed2(app, event)
            figure('position',[0,app.setting.screen(2)-565,800,480]);
            app.userfig = gca;
%             xlabel('Stride Percent(%)');
%             legend('show');
%             hleg = legend('boxoff');
%             set(hleg,'Interpreter','none')
            hold on;
            h = gca;
            h.Box = 'off';
            h.FontName = 'Times New Roman';
            h.FontSize = 14;
            h = gcf;
            h.Color = [1,1,1];
            app.userpl = struct;
        end

        % Button pushed function: STRIDEPLOTButton
        function STRIDEPLOTButtonPushed(app, event)
            
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.VariableListBox.Value);
            linewidth = char(app.LineWidthDropDown.Value);
            linetype = char(app.LineTypeDropDown.Value);
            markersize = char(app.MarkerSizeDropDown.Value);
            markertype = char(app.MarkerTypeDropDown.Value);
            colordata = app.setting.usercolor;
            
            stride_percent = 0:0.1:100;
            
            eval(['processflag = app.data.' data_name '.processFlag;']);
            
            if ~processflag
                errordlg('Please process data first','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            elseif isempty(var_name)
                errordlg('Please select a variable','error');
            else
                eval(['data_temp =   app.data.' data_name '.' var_name '.stride;']);
                
                % 数据反向处理
                if app.ReverseCheckBox.Value == 1
                    data_each = -data_temp.each;
                    data_mean = -data_temp.mean;
                    data_std  = -data_temp.std;
                else
                    data_each = data_temp.each;
                    data_mean = data_temp.mean;
                    data_std  = data_temp.std;
                end
                
                % 绘制每条轨迹
                if app.eachCheckBox.Value == 1
                    userAlpha = 0.6;
                    for j = 1:length(data_each(:,1))
                        p = plot(app.userfig, stride_percent, data_each(j,:),'-','color',1.0 - userAlpha*(1.0 - colordata), 'EraseMode', 'xor','LineWidth',0.5);
                        pl_num = length(fieldnames(app.userpl));
                        eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                    end
                end
                % 绘制误差区域
                if app.stdCheckBox.Value == 1
                    h = area(app.userfig, stride_percent,[data_mean' - 1*data_std', 2 * data_std']);
%                     h = area(app.userfig, stride_percent,[data_mean' - 3', 6*ones(1,1001)']);
                    set(h(1),'Visible','off');
                    set(h(2),'EdgeColor','none','FaceColor',colordata,'FaceAlpha',0.4,'ShowBaseLine','off');
                    pl_num = length(fieldnames(app.userpl));
                    eval(['app.userpl.p' num2str(pl_num+1) ' = h;']);
                end
                % 绘制平均曲线
                if app.meanCheckBox.Value == 1
                    eval(['p = plot(app.userfig, stride_percent, data_mean'',''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''Marker'',''' markertype ''',''MarkerSize'',' markersize ',''color'', colordata);']);
                    pl_num = length(fieldnames(app.userpl));
                    eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                end
            end
        end

        % Callback function
        function ALTERButtonPushed(app, event)
            app.AnaDataGroup.SelectedTab = app.PLOTALLTab;
            app.PlotGroup.SelectedTab = app.ALTERTab;
            app.DataListBox.Items = app.data.name;
            app.updateKeyVarTable();
        end

        % Callback function
        function PLOTCLEARButton2Pushed(app, event)
            
            pl_name = fieldnames(app.userpl);
            eval(['delete(app.userpl.' pl_name{end} ');']);
            eval(['app.userpl = rmfield(app.userpl, ''' pl_name{end} ''');']);
            
        end

        % Value changed function: ColorMapDropDown
        function ColorMapDropDownValueChanged(app, event)
            
            app.upColorMap();
            app.setting.ColorIndex = 0;
            
        end

        % Callback function
        function ALTERSelectVarButtonPushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.KeyVariableListBox.Value);
            app.VarLabel.Text = [data_name '.' var_name];         
        end

        % Callback function
        function ALTERStridePlotButtonPushed(app, event)
            data_name = char(app.VarLabel.Text);
            data_name_split = strsplit(data_name,'.');
            eval(['processflag = app.data.' data_name_split{1} '.' data_name_split{2} '.processFlag;']);
            
            if ~processflag
                errordlg('Please process data first','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            else
                eval(['stride_data = app.data.' data_name '.stride.each;']);
                stride_percent = 0:0.1:100;
                datalen = size(stride_data,1);
                linewidth = char(app.LineWidthDropDown.Value);
                colorname = char(app.ColorMapDropDown.Value);
                colordata = app.othercolor(colorname,datalen);
                for stride_index = 1:datalen
                    eval(['p = plot(app.userfig, stride_percent, stride_data(stride_index,:),''LineWidth'',' linewidth ',''color'', colordata(stride_index,:) );']);
                    pl_num = length(fieldnames(app.userpl));
                    eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                end
            end
        end

        % Callback function
        function ALTERNEWButtonPushed(app, event)
            figure('position',[0,app.setting.screen(2)-565,800,480]);
            app.userfig = gca;
%             legend('show');
%             hleg = legend('boxoff');
%             set(hleg,'Interpreter','none')
            hold on;
            h = gca;
            h.Box = 'off';
            h.FontName = 'Times New Roman';
            h.FontSize = 14;
            h = gcf;
            h.Color = [1,1,1];
            app.userpl = struct;
        end

        % Button pushed function: ClearLastButton
        function ClearLastButtonPushed(app, event)
            pl_name = fieldnames(app.userpl);
            eval(['delete(app.userpl.' pl_name{end} ');']);
            eval(['app.userpl = rmfield(app.userpl, ''' pl_name{end} ''');']);
            app.userbar = struct;
        end

        % Button pushed function: ClearAllButton
        function ClearAllButtonPushed(app, event)
            if ~isempty(app.userfig)
                cla(app.userfig);
                app.userpl = struct;
            end
        end

        % Callback function
        function VarAlterAddButtonPushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            data_name_split = strsplit(data_name,'.');
            var_name = char(app.KeyVariableListBox.Value);
            
            eval(['processflag = app.data.' data_name '.processFlag;']);
            
            if ~processflag
                errordlg('Please process data first','error');
            elseif isempty(var_name)
                errordlg('Please select a variable','error');
            else
                if isempty(app.data.comp.name)
                    alter_var_name = [data_name_split{2} '_' var_name];
                    eval(['var_data = app.data.' data_name '.' var_name ';']);
                    app.data.comp.name = {alter_var_name};
                    eval(['app.data.comp.' alter_var_name ' = var_data;']);
                else
                    alter_var_name = [data_name_split{2} '_' var_name];
                    eval(['var_data = app.data.' data_name '.' var_name ';']);
                    app.data.comp.name(end+1) = {alter_var_name};
                    eval(['app.data.comp.' alter_var_name ' = var_data;']);
                end
                app.VarAlterListBox.Items = app.data.comp.name;
            end
            
        end

        % Callback function
        function SETCOLORMAPButtonPushed(app, event)
            if isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            else 
                colorname = app.ColorMapDropDown.Value;
                colordata = app.othercolor(colorname,0);
                if colordata(1,:) == [1, 1, 1]
                    colormap(app.userfig, colordata(2:end,:));
                else
                    colormap(app.userfig, colordata);
                end
            end
        end

        % Callback function
        function VarAlterDeleteButtonPushed(app, event)
            var_name = char(app.VarAlterListBox.Value);
            
            if isempty(var_name)
                errordlg('Please select a alter variable','error');
            else
                for i = 1:length(app.data.comp.name)
                    if strcmp(app.data.comp.name(i),var_name)
                        app.data.comp.name(i) = [];
                        break;
                    end
                end
                
                eval(['app.data.comp = rmfield(app.data.comp, ''' var_name ''');']);
                app.VarAlterListBox.Items = app.data.comp.name;
            end
            
            
        end

        % Callback function
        function VarAlterClearButtonPushed(app, event)
            app.data.comp = struct;
            app.data.comp.name = {};
            app.VarAlterListBox.Items = app.data.comp.name;
        end

        % Callback function
        function VarAlterRenameButtonPushed(app, event)
            var_name = char(app.VarAlterListBox.Value);
            
            if isempty(var_name)
                errordlg('Please select a alter variable','error');
            else
                new_name = char(inputdlg('Input the new name：','ReName'));
                if ~isempty(new_name)
                    for i = 1:length(app.data.comp.name)
                        if strcmp(app.data.comp.name(i),var_name)
                            app.data.comp.name(i) = {new_name};
                            break;
                        end
                    end
                    
                    eval(['app.data.comp.' new_name ' = app.data.comp.' var_name ';']);
                    eval(['app.data.comp = rmfield(app.data.comp, ''' var_name ''');']);
                    app.VarAlterListBox.Items = app.data.comp.name;
                end
            end
            
        end

        % Callback function
        function VarAlterUpButtonPushed(app, event)
            var_name = char(app.VarAlterListBox.Value);
            
            if isempty(var_name)
                errordlg('Please select a alter variable','error');
            else
                for i = 1:length(app.data.comp.name)
                    if strcmp(app.data.comp.name(i),var_name)
                        if i > 1
                            name_temp = app.data.comp.name(i);
                            app.data.comp.name(i) = app.data.comp.name(i-1);
                            app.data.comp.name(i-1) = name_temp;
                            break;
                        end
                    end
                end

                app.VarAlterListBox.Items = app.data.comp.name;
            end
        end

        % Callback function
        function VarAlterDownButtonPushed(app, event)
            var_name = char(app.VarAlterListBox.Value);
            
            if isempty(var_name)
                errordlg('Please select a alter variable','error');
            else
                for i = 1:length(app.data.comp.name)
                    if strcmp(app.data.comp.name(i),var_name)
                        if i < length(app.data.comp.name)
                            name_temp = app.data.comp.name(i);
                            app.data.comp.name(i) = app.data.comp.name(i+1);
                            app.data.comp.name(i+1) = name_temp;
                            break;
                        end
                    end
                end

                app.VarAlterListBox.Items = app.data.comp.name;
            end
        end

        % Callback function
        function VarAlterPlotButtonPushed(app, event)
            comp_num = length(app.data.comp.name);
            colormapname = app.ColorMapDropDown.Value;
            comp_color = app.othercolor(colormapname,comp_num);
            linewidth = char(app.LineWidthDropDown.Value);
            
            if comp_num == 0
                errordlg('Please add alter variables','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            else
                stride_percent = 0:0.1:100;
                for i = 1:comp_num
                    eval(['data_mean = app.data.comp.' app.data.comp.name{i} '.stride.mean;']);
                    if app.FlipCheckBox.Value == 1
                        data_mean = - data_mean;
                    end
                    eval(['p = plot(app.userfig, stride_percent, data_mean,''color'', comp_color(i,:) ,''LineWidth'',' linewidth ');']);
                    pl_num = length(fieldnames(app.userpl));
                    eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                end
            end
            
        end

        % Callback function
        function PAHSEXSelectVarButtonPushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.KeyVariableListBox.Value);
            app.VarXNameLabel.Text = [data_name '.' var_name];     
        end

        % Callback function
        function PAHSEYSelectVarButtonPushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.KeyVariableListBox.Value);
            app.VarYNameLabel.Text = [data_name '.' var_name];    
        end

        % Callback function
        function ALTERNEWButton_3Pushed(app, event)
            figure('position',[0,app.setting.screen(2)-565,800,480]);
            app.userfig = gca;
            xlabel('X');
            ylabel('Y');
%             legend('show');
%             hleg = legend('boxoff');
%             set(hleg,'Interpreter','none')
            hold on;
            h = gca;
            h.Box = 'off';
            h.FontName = 'Times New Roman';
            h.FontSize = 14;
            h = gcf;
            h.Color = [1,1,1];
            app.userpl = struct;
        end

        % Callback function
        function ALTERStridePlotButton_2Pushed(app, event)
            Xdata_name = char(app.VarXNameLabel.Text);
            Ydata_name = char(app.VarYNameLabel.Text);
            Xdata_name_split = strsplit(Xdata_name,'.');
            Ydata_name_split = strsplit(Ydata_name,'.');
            
            linewidth = char(app.LineWidthDropDown.Value);
            phase_len = app.EndTimeSlider.Value*10;
            
            eval(['processflagX = app.data.' Xdata_name_split{1} '.' Xdata_name_split{2} '.processFlag;']);
            eval(['processflagY = app.data.' Ydata_name_split{1} '.' Ydata_name_split{2} '.processFlag;']);
            
            if ~processflagX || ~processflagY
                errordlg('Please process data first','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            else
                eval(['stride_dataX = app.data.' Xdata_name '.stride.mean;']);
                eval(['stride_dataY = app.data.' Ydata_name '.stride.mean;']);
                stride_percent = 0:0.1:100;
                
                if app.XreverseCheckBox.Value == 1
                    stride_dataX = - stride_dataX;
                end
                if app.YreverseCheckBox.Value == 1
                    stride_dataY = - stride_dataY;
                end
                
                colorname = app.ColorMapDropDown.Value;
                colordata = app.othercolor(colorname,1001);
                colordata = [colordata(2:1001,:); 1 1 1];
                colormap(app.userfig, colordata);
                
                eval(['p = patch(stride_dataX(1:phase_len),stride_dataY(1:phase_len),stride_percent(1:phase_len),''edgecolor'',''flat'',''facecolor'',''none'',''LineWidth'',' linewidth ');']);
                pl_num = length(fieldnames(app.userpl));
                eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);

            end
        end

        % Callback function
        function COMPButtonPushed(app, event)
            app.AnaDataGroup.SelectedTab = app.PLOTALLTab;
            app.PlotGroup.SelectedTab = app.COMPTab;
            app.DataListBox.Items = app.data.name;
            app.updateKeyVarTable();
        end

        % Callback function
        function VarAlterPlotButton_2Pushed(app, event)
            comp_num = length(app.data.comp.name);
            colormapname = app.ColorMapDropDown.Value;
            
            if comp_num == 0
                errordlg('Please add alter variables','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            else
                app.ClearAllButton.ButtonPushedFcn(app,1);
                colordata = app.othercolor(colormapname,length(app.data.comp.name));
%                 colormap(app.userfig, colordata);
                
                data_mean = zeros(length(app.data.comp.name),1);
                data_std = zeros(length(app.data.comp.name),1);
                data_name = app.data.comp.name;
                
                for i = 1:length(app.data.comp.name)
                    eval(['data_mean(i) = app.data.comp.' char(app.data.comp.name(i)) '.' app.BarFeatureDropDown.Value '.mean;']);
                    eval(['data_std(i) = app.data.comp.' char(app.data.comp.name(i)) '.' app.BarFeatureDropDown.Value '.std;']);
                end
                
                numgroups = size(data_mean, 1);
                numbars = size(data_mean, 2);
                groupwidth = min(0.8, numbars/(numbars+1.5));
                bar_index = [1:numgroups]';
                
                b = bar(app.userfig, data_mean, 0.6, 'grouped');
                b.FaceColor = 'flat';
                set(b,'edgecolor','none');
                b.CData = colordata;
                hold on;
                
                pl_num = length(fieldnames(app.userpl));
                eval(['app.userpl.p' num2str(pl_num+1) ' = b;']);
                app.userbar = b;
                
                if strcmp(app.BarTypeDropDown.Value, 'error-bar')
                    for i = 1:numbars
                        x = (1:numgroups) - groupwidth/2 + (2*i-1) * groupwidth / (2*numbars);% Aligning error bar with individual bar
                        b = errorbar(app.userfig,x, data_mean(:,i), data_std(:,i), 'k', 'linestyle', 'none', 'LineWidth', 1, 'CapSize', 10);
                        pl_num = length(fieldnames(app.userpl));
                        eval(['app.userpl.p' num2str(pl_num+1) ' = b;']);
                    end
                end
                
                set(app.userfig, 'xtick', bar_index);
                set(app.userfig, 'xticklabel', data_name);
                set(app.userfig, 'TickLabelInterpreter', 'none');
                
                h = gca;
                h.Box = 'off';
                h.FontName = 'Times New Roman';
                h.FontSize = 12;
                h = gcf;
                h.Color = [1,1,1];
                app.IndexDropDown.Items = data_name;
            end
        end

        % Callback function
        function CHANGECOLORButtonPushed(app, event)
            app.setting.usercolor = uisetcolor(app.setting.usercolor);
            var_name = char(app.IndexDropDown.Value);
            data_name = app.data.comp.name;
            for i = 1:length(data_name)
                    if strcmp(data_name(i),var_name)
                        app.userbar.CData(i,:) = app.setting.usercolor;
                    end
            end
            app.Lamp.BackgroundColor = app.setting.usercolor;
        end

        % Button pushed function: GROUPBARButton
        function GROUPBARButtonPushed(app, event)
%             app.moveui('app.Panel_3',35,-520,10,200);
%             app.moveui('app.Panel_7',276,-576,10,200);
%             app.moveui('app.Panel_12',276,-576,10,200);
%             app.moveui('app.Panel_13',276,-576,10,200);
% %             app.moveui('app.Panel_2',35,30,10,200);
%             app.moveui('app.Panel_8',276,2,10,200);
%             app.moveui('app.Panel_4',1080,590,200,10);
%             app.moveui('app.Panel_6',1080,590,200,10);
%             app.moveui('app.Panel_5',296,590,200,10);
            for i = 1:length(app.PlotButtonGroup.Children)
                app.PlotButtonGroup.Children(i).BackgroundColor = app.setting.backcolorset.defult(1,:);
            end
            app.GROUPBARButton.BackgroundColor = app.setting.backcolorset.defult(2,:);
            
            app.PlotGroup.SelectedTab = app.BarTab;
            app.DataListBox.Items = app.data.name;
            app.updateKeyVarTable();
        end

        % Button pushed function: ClassAddButton_3
        function ClassAddButtonPushed(app, event)
            data_name = char(app.DataListBox.Value);

            if isempty(data_name)
                errordlg('Please select a Data','error');
            else
                
                if size(data_name,1) == 1
                    data_name_split = strsplit(data_name,'.');
                    
                    eval(['processflag = app.data.' data_name '.processFlag;']);
                    
                    if ~processflag
                        errordlg('Please process data first','error');
                    else
                        if isempty(app.data.groupbar.class.name)
                            app.data.groupbar.class.name = {data_name_split{2}};
                            eval(['app.data.groupbar.class.' data_name_split{2} ' = {data_name};']);
                        else
                            app.data.groupbar.class.name(end+1) = {data_name_split{2}};
                            eval(['app.data.groupbar.class.' data_name_split{2} ' = {data_name};']);
                        end
                        app.ClassListBox.Items = app.data.groupbar.class.name;
                    end
                else
                    for i = 1:size(data_name,1)
                        
                        data_name_split = strsplit(data_name(i,:),'.');
                        eval(['processflag = app.data.' data_name(i,:) '.processFlag;']);
                        
                        if ~processflag
                            errordlg('Please process data first','error');
                        else
                            if isempty(app.data.groupbar.class.name)
                                app.data.groupbar.class.name = {data_name_split{2}};
                                eval(['app.data.groupbar.class.' data_name_split{2} ' = {data_name(i,:)};']);
                            else
                                app.data.groupbar.class.name(end+1) = {data_name_split{2}};
                                eval(['app.data.groupbar.class.' data_name_split{2} ' = {data_name(i,:)};']);
                            end
                            app.ClassListBox.Items = app.data.groupbar.class.name;
                        end
                    end
                end
            end
            
        end

        % Button pushed function: ClassDeleteButton_3
        function ClassDeleteButtonPushed(app, event)
            class_name = char(app.ClassListBox.Value);
            
            if isempty(class_name)
                errordlg('Please select a class','error');
            else
                for i = 1:length(app.data.groupbar.class.name)
                    if strcmp(app.data.groupbar.class.name(i),class_name)
                        app.data.groupbar.class.name(i) = [];
                        break;
                    end
                end
                
                eval(['app.data.groupbar.class = rmfield(app.data.groupbar.class, ''' class_name ''');']);
                app.ClassListBox.Items = app.data.groupbar.class.name;
            end
        end

        % Button pushed function: ClassClearButton_3
        function ClassClearButtonPushed(app, event)
            app.data.groupbar.class = struct;
            app.data.groupbar.class.name = {};
            app.ClassListBox.Items = app.data.groupbar.class.name;
        end

        % Button pushed function: ClassUpButton_3
        function ClassUpButtonPushed(app, event)
            class_name = char(app.ClassListBox.Value);
            
            if isempty(class_name)
                errordlg('Please select a class','error');
            else
                for i = 1:length(app.data.groupbar.class.name)
                    if strcmp(app.data.groupbar.class.name(i),class_name)
                        if i > 1
                            name_temp = app.data.groupbar.class.name(i);
                            app.data.groupbar.class.name(i) = app.data.groupbar.class.name(i-1);
                            app.data.groupbar.class.name(i-1) = name_temp;
                            break;
                        end
                    end
                end
                app.ClassListBox.Items = app.data.groupbar.class.name;
            end
        end

        % Button pushed function: ClassDownButton_3
        function ClassDownButtonPushed(app, event)
            class_name = char(app.ClassListBox.Value);
            
            if isempty(class_name)
                errordlg('Please select a class','error');
            else
                for i = 1:length(app.data.groupbar.class.name)
                    if strcmp(app.data.groupbar.class.name(i),class_name)
                        if i < length(app.data.groupbar.class.name)
                            name_temp = app.data.groupbar.class.name(i);
                            app.data.groupbar.class.name(i) = app.data.groupbar.class.name(i+1);
                            app.data.groupbar.class.name(i+1) = name_temp;
                            break;
                        end
                    end
                end

                app.ClassListBox.Items = app.data.groupbar.class.name;
            end
        end

        % Button pushed function: ClassRenameButton
        function ClassRenameButtonPushed(app, event)
            class_name = char(app.ClassListBox.Value);
            
            if isempty(class_name)
                errordlg('Please select a class','error');
            else
                new_name = char(inputdlg('Input the new name：','ReName'));
                if ~isempty(new_name)
                    for i = 1:length(app.data.groupbar.class.name)
                        if strcmp(app.data.groupbar.class.name(i),class_name)
                            app.data.groupbar.class.name(i) = {new_name};
                            break;
                        end
                    end
                    
                    eval(['app.data.groupbar.class.' new_name ' = app.data.groupbar.class.' class_name ';']);
                    eval(['app.data.groupbar.class = rmfield(app.data.groupbar.class, ''' class_name ''');']);
                    app.ClassListBox.Items = app.data.groupbar.class.name;
                end
            end
        end

        % Button pushed function: GroupAddButton
        function GroupAddButtonPushed(app, event)
            var_name = char(app.VariableListBox.Value);
            
            if isempty(var_name)
                errordlg('Please select a Variable','error');
            else
                if isempty(app.data.groupbar.group.name)
                    app.data.groupbar.group.name = {var_name};
                    eval(['app.data.groupbar.group.' var_name ' = {var_name};']);
                else
                    app.data.groupbar.group.name(end+1) = {var_name};
                    eval(['app.data.groupbar.group.' var_name ' = {var_name};']);
                end
                app.GroupListBox.Items = app.data.groupbar.group.name;
            end
        end

        % Button pushed function: GroupDeleteButton
        function GroupDeleteButtonPushed(app, event)
            group_name = char(app.GroupListBox.Value);
            
            if isempty(group_name)
                errordlg('Please select a group','error');
            else
                for i = 1:length(app.data.groupbar.group.name)
                    if strcmp(app.data.groupbar.group.name(i),group_name)
                        app.data.groupbar.group.name(i) = [];
                        break;
                    end
                end
                
                eval(['app.data.groupbar.group = rmfield(app.data.groupbar.group, ''' group_name ''');']);
                app.GroupListBox.Items = app.data.groupbar.group.name;
            end
        end

        % Button pushed function: GroupClearButton
        function GroupClearButtonPushed(app, event)
            app.data.groupbar.group = struct;
            app.data.groupbar.group.name = {};
            app.GroupListBox.Items = app.data.groupbar.group.name;
        end

        % Button pushed function: GroupUpButton
        function GroupUpButtonPushed(app, event)
            group_name = char(app.GroupListBox.Value);
            
            if isempty(group_name)
                errordlg('Please select a group','error');
            else
                for i = 1:length(app.data.groupbar.group.name)
                    if strcmp(app.data.groupbar.group.name(i),group_name)
                        if i > 1
                            name_temp = app.data.groupbar.group.name(i);
                            app.data.groupbar.group.name(i) = app.data.groupbar.group.name(i-1);
                            app.data.groupbar.group.name(i-1) = name_temp;
                            break;
                        end
                    end
                end
                app.GroupListBox.Items = app.data.groupbar.group.name;
            end
        end

        % Button pushed function: GroupDownButton
        function GroupDownButtonPushed(app, event)
            group_name = char(app.GroupListBox.Value);
            
            if isempty(group_name)
                errordlg('Please select a group','error');
            else
                for i = 1:length(app.data.groupbar.group.name)
                    if strcmp(app.data.groupbar.group.name(i),group_name)
                        if i < length(app.data.groupbar.group.name)
                            name_temp = app.data.groupbar.group.name(i);
                            app.data.groupbar.group.name(i) = app.data.groupbar.group.name(i+1);
                            app.data.groupbar.group.name(i+1) = name_temp;
                            break;
                        end
                    end
                end
                app.GroupListBox.Items = app.data.groupbar.group.name;
            end
        end

        % Button pushed function: GroupRenameButton
        function GroupRenameButtonPushed(app, event)
            group_name = char(app.GroupListBox.Value);
            
            if isempty(group_name)
                errordlg('Please select a group','error');
            else
                new_name = char(inputdlg('Input the new name：','ReName'));
                if ~isempty(new_name)
                    for i = 1:length(app.data.groupbar.group.name)
                        if strcmp(app.data.groupbar.group.name(i),group_name)
                            app.data.groupbar.group.name(i) = {new_name};
                            break;
                        end
                    end
                    
                    eval(['app.data.groupbar.group.' new_name ' = app.data.groupbar.group.' group_name ';']);
                    eval(['app.data.groupbar.group = rmfield(app.data.groupbar.group, ''' group_name ''');']);
                    app.GroupListBox.Items = app.data.groupbar.group.name;
                end
            end
        end

        % Callback function
        function ALTERNEWButton_5Pushed(app, event)
            figure('position',[0,app.setting.screen(2)-565,800,480]);
            app.userfig = gca;
            hold on;
            h = gca;
            h.Box = 'off';
            h.FontName = 'Times New Roman';
            h.FontSize = 14;
            h = gcf;
            h.Color = [1,1,1];
            app.userpl = struct;
        end

        % Button pushed function: VarAlterPlotButton
        function VarAlterPlotButton_3Pushed(app, event)
            class_num = length(app.data.groupbar.class.name);
            group_num = length(app.data.groupbar.group.name);
            class_name = app.data.groupbar.class.name;
            group_name = app.data.groupbar.group.name;
            colormapname = app.ColorMapDropDown.Value;
            colordata = app.othercolor(colormapname,class_num);
            feature = char(app.BarFeatureDropDown.Value);
            
            if class_num == 0
                errordlg('Please add class','error');
            elseif group_num == 0
                errordlg('Please add group','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            else
                app.ClearAllButton.ButtonPushedFcn(app,1);
                
                data_mean = zeros(group_num,class_num);
                data_std  = zeros(group_num,class_num);
                
                for i = 1:class_num
                    eval(['data_name = char(app.data.groupbar.class.' char(class_name(i)) ');']);
                    for j = 1:group_num
                        eval(['var_name = char(app.data.groupbar.group.' char(group_name(j)) ');']);
                        eval(['data_mean(j,i) = app.data.' data_name  '.' var_name '.' feature '.mean;']);
                        eval([' data_std(j,i) = app.data.' data_name  '.' var_name '.' feature '.std;']);
                    end
                end
                
                numgroups = group_num;
                numbars = class_num;
                groupwidth = min(0.8, numbars/(numbars+1.5)); 
                bar_index = [1:numgroups]';
                
                b = bar(app.userfig, data_mean, 'grouped', 'FaceColor', 'flat');
                set(b,'edgecolor','none');
                if numgroups == 1
                    b.CData = colordata;
                else
                    for i = 1:length(b)
                        b(i).CData = repmat(colordata(i,:), group_num, 1);
                    end
                end
                hold on;
                
                pl_num = length(fieldnames(app.userpl));
                eval(['app.userpl.p' num2str(pl_num+1) ' = b;']);
                app.userbar = b;
                
                if strcmp(app.BarTypeDropDown.Value, 'error-bar')
                    if numgroups == 1
                        for i = 1:numbars
                            x = i;% Aligning error bar with individual bar
                            b = errorbar(app.userfig,x, data_mean(:,i), data_std(:,i), 'k', 'linestyle', 'none', 'LineWidth', 1, 'CapSize', 10);
                            pl_num = length(fieldnames(app.userpl));
                            eval(['app.userpl.p' num2str(pl_num+1) ' = b;']);
                        end
                    else
                        for i = 1:numbars
                            x = (1:numgroups) - groupwidth/2 + (2*i-1) * groupwidth / (2*numbars);% Aligning error bar with individual bar
                            b = errorbar(app.userfig,x, data_mean(:,i), data_std(:,i), 'k', 'linestyle', 'none', 'LineWidth', 1, 'CapSize', 10);
                            pl_num = length(fieldnames(app.userpl));
                            eval(['app.userpl.p' num2str(pl_num+1) ' = b;']);
                        end
                    end
                end
                
                if numgroups == 1
                    set(app.userfig, 'xtick', [1:numbars]');
                    set(app.userfig, 'xticklabel', class_name);
                    set(app.userfig, 'TickLabelInterpreter', 'none');
                else
                    set(app.userfig, 'xtick', bar_index);
                    set(app.userfig, 'xticklabel', group_name);
                    set(app.userfig, 'TickLabelInterpreter', 'none');
                    
                    l = legend(class_name);
                    set(l, 'Box', 'off');
                    set(l, 'Interpreter', 'none');
                end
                
                h = gca;
                h.Box = 'off';
                h.FontName = 'Times New Roman';
                h.FontSize = 12;
                h = gcf;
                h.Color = [1,1,1];
                app.GroupIndexDropDown.Items = class_name;
            end
        end

        % Button pushed function: CHANGECOLORButton
        function CHANGECOLORButton_2Pushed(app, event)
%             app.setting.usercolor = uisetcolor(app.setting.usercolor);
            var_name = char(app.GroupIndexDropDown.Value);
            class_name = app.data.groupbar.class.name;
            group_num = length(app.data.groupbar.group.name);
            if group_num == 1
                for i = 1:length(class_name)
                    if strcmp(class_name(i),var_name)
                        app.userbar.CData(i,:) = app.setting.usercolor;
                    end
                end
                
            else
                for i = 1:length(class_name)
                        if strcmp(class_name(i),var_name)
                            app.userbar(i).CData = repmat(app.setting.usercolor, group_num, 1);
                        end
                end
            end
%             app.Lamp.BackgroundColor = app.setting.usercolor;
        end

        % Callback function
        function EndTimeSliderValueChanged(app, event)
            app.ClearLastButton.ButtonPushedFcn(app,1);
            app.ALTERStridePlotButton_2.ButtonPushedFcn(app,1);
        end

        % Callback function
        function NEXTCOLORButtonPushed(app, event)
            colormapname = app.ColorMapDropDown.Value;
            colordata = app.othercolor(colormapname,0);
            colornum = size(colordata,1);
            
            if app.setting.ColorIndex >= colornum
                app.setting.ColorIndex = 1;
            elseif app.setting.ColorIndex == 0
                app.setting.ColorIndex = 1;
            else
                app.setting.ColorIndex = app.setting.ColorIndex + 1;
            end
            
            app.setting.usercolor = colordata(app.setting.ColorIndex,:);
            app.Lamp.BackgroundColor = app.setting.usercolor;
            
        end

        % Button pushed function: ExtractSCONEDataButton
        function ExtractSCONEDataButtonPushed(app, event)
            [file,path,indx] = uigetfile('*.sto','Select the SCONE STO file');
        
            if indx == 1
                data_name = file(1:end-4);
                scone_data = {};
                
                % 加载数据
                delimmiter = '	';
                filename = fullfile(path, file);
                nheaderlines = 7;
                DataStru = importdata(filename,delimmiter,nheaderlines);
                SconeData.name = reshape(DataStru.colheaders,[length(DataStru.colheaders) 1]);
                SconeData.data = DataStru.data;
                
                for var_index = 1:length(SconeData.name)
                    var_name = char(SconeData.name(var_index));
                    var_name = strrep(var_name,'.','_');
                    var_name = strrep(var_name,'-','_');
                    eval(['scone_data.name(var_index,1) = {var_name};']);
                    eval(['scone_data.' var_name ' = SconeData.data(:,var_index)'';']);
                end
                
                C = 1; %180/pi;
                
                time = scone_data.time';
                pelvis_tilt = scone_data.pelvis_tilt'*C;pelvis_tx = scone_data.pelvis_tx';pelvis_ty = scone_data.pelvis_ty';
                hip_flexion_r = scone_data.hip_flexion_r'*C;knee_angle_r = scone_data.knee_angle_r'*C;ankle_angle_r = scone_data.ankle_angle_r'*C;
                hip_flexion_l = scone_data.hip_flexion_l'*C;knee_angle_l = scone_data.knee_angle_l'*C;ankle_angle_l = scone_data.ankle_angle_l'*C;
%                 lumbar_extension = zeros(length(scone_data.time),1);
%                 pelvis_move = ((1:length(pelvis_tx))/length(pelvis_tx)*pelvis_tx(end))';
%                 pelvis_tx = pelvis_tx - pelvis_move;
%                 Kine_data = [time,pelvis_tilt,pelvis_tx,pelvis_ty,hip_flexion_r,knee_angle_r,ankle_angle_r,hip_flexion_l,knee_angle_l,ankle_angle_l,lumbar_extension];
%                 
%                 fp = fopen('sim_kine.sto','w+');
%                 fprintf(fp,'%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n\r\n%s\r\n%s\r\n\r\n%s\r\n','Coordinates','version=1',['nRows=' num2str(length(time))],'nColumns=11','inDegrees=no','Units are S.I. units (second, meters, Newtons, ...)','Angles are in rad.','endheader');
%                 fprintf(fp,'%s %s %s %s %s %s %s %s %s %s %s\r\n','time','pelvis_tilt','pelvis_tx','pelvis_ty','hip_flexion_r','knee_angle_r','ankle_angle_r','hip_flexion_l','knee_angle_l','ankle_angle_l','lumbar_extension');
%                 fprintf(fp,'%f %f %f %f %f %f %f %f %f %f %f\r\n',Kine_data);
                Kine_data = [time,pelvis_tilt,pelvis_tx,pelvis_ty,hip_flexion_r,knee_angle_r,ankle_angle_r,hip_flexion_l,knee_angle_l,ankle_angle_l];
                
                fp = fopen('sim_kine.sto','w+');
                fprintf(fp,'%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n\r\n%s\r\n%s\r\n\r\n%s\r\n','Coordinates','version=1',['nRows=' num2str(length(time))],'nColumns=10','inDegrees=no','Units are S.I. units (second, meters, Newtons, ...)','Angles are in rad.','endheader');
                fprintf(fp,'%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\r\n','time','pelvis_tilt','pelvis_tx','pelvis_ty','hip_flexion_r','knee_angle_r','ankle_angle_r','hip_flexion_l','knee_angle_l','ankle_angle_l');
                fprintf(fp,'%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\r\n',Kine_data');
                
                ground_force_vx = scone_data.leg1_r_grf_x';ground_force_vy = scone_data.leg1_r_grf_y';ground_force_vz = scone_data.leg1_r_grf_z';
                ground_force_px = scone_data.leg1_r_cop_x';ground_force_py = scone_data.leg1_r_cop_y';ground_force_pz = scone_data.leg1_r_cop_z';
                l_ground_force_vx = scone_data.leg0_l_grf_x';l_ground_force_vy = scone_data.leg0_l_grf_y';l_ground_force_vz = scone_data.leg0_l_grf_z';
                l_ground_force_px = scone_data.leg0_l_cop_x';l_ground_force_py = scone_data.leg0_l_cop_y';l_ground_force_pz = scone_data.leg0_l_cop_z';
                ground_torque_x = zeros(length(time),1);ground_torque_y = zeros(length(time),1);ground_torque_z = zeros(length(time),1);
                l_ground_torque_x = zeros(length(time),1);l_ground_torque_y = zeros(length(time),1);l_ground_torque_z = zeros(length(time),1);
%                 ground_torque_x = scone_data.foot_r_moment_x';ground_torque_y = scone_data.foot_r_moment_y';ground_torque_z = scone_data.foot_r_moment_z';
%                 l_ground_torque_x = scone_data.foot_l_moment_x';l_ground_torque_y = scone_data.foot_l_moment_y';l_ground_torque_z = scone_data.foot_l_moment_z';
%                 for i = 1:length(time)
%                     if ground_force_px(i) > 0.0001
%                         ground_force_px(i) = ground_force_px(i) - pelvis_move(i);
%                     end
%                     if l_ground_force_px(i) > 0.0001
%                         l_ground_force_px(i) = l_ground_force_px(i) - pelvis_move(i);
%                     end
%                 end
                Grf_data = [time, ground_force_vx, ground_force_vy, ground_force_vz, ground_force_px, ground_force_py, ground_force_pz,...
                    l_ground_force_vx, l_ground_force_vy, l_ground_force_vz, l_ground_force_px, l_ground_force_py, l_ground_force_pz,...
                    ground_torque_x, ground_torque_y, ground_torque_z, l_ground_torque_x, l_ground_torque_y, l_ground_torque_z];
                
                fp = fopen('sim_grf.mot','w+');
                fprintf(fp,'%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n','sim_grf.mot','version=1',['nRows=' num2str(length(time))],'nColumns=19','inDegrees=no','endheader');
                fprintf(fp,'%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\r\n',...
                    'time', 'ground_force_vx', 'ground_force_vy', 'ground_force_vz', 'ground_force_px', 'ground_force_py', 'ground_force_pz',...
                    '1_ground_force_vx', '1_ground_force_vy', '1_ground_force_vz', '1_ground_force_px', '1_ground_force_py', '1_ground_force_pz',...
                    'ground_torque_x', 'ground_torque_y', 'ground_torque_z', '1_ground_torque_x', '1_ground_torque_y', '1_ground_torque_z');
                fprintf(fp,'%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\t%f\r\n',Grf_data');
            end
        end

        % Callback function
        function ALTERNEWButton_6Pushed(app, event)
            comp_num = length(app.data.comp.name);
            colormapname = app.ColorMapDropDown.Value;
            
            if comp_num == 0
                errordlg('Please add alter variables','error');
            else
                bar_data = struct;
                
                data_mean = zeros(length(app.data.comp.name),1);
                data_std = zeros(length(app.data.comp.name),1);
                data_name = app.data.comp.name;
                
                for i = 1:length(app.data.comp.name)
                    eval(['data_mean(i) = app.data.comp.' char(app.data.comp.name(i)) '.' app.BarFeatureDropDown.Value '.mean;']);
                    eval(['data_std(i) = app.data.comp.' char(app.data.comp.name(i)) '.' app.BarFeatureDropDown.Value '.std;']);
                end
                
                bar_data.name = data_name;
                bar_data.mean = data_mean';
                bar_data.std  = data_std';
                
                [file, path]=uiputfile('AnaBarData.mat','Save data name');
                if ~(isequal(file,0))  
                    save(fullfile(path, file),'bar_data');
                end
            
            end
        end

        % Button pushed function: ALTERNEWButton_9
        function ALTERNEWButton_7Pushed(app, event)
            class_num = length(app.data.groupbar.class.name);
            group_num = length(app.data.groupbar.group.name);
            class_name = app.data.groupbar.class.name;
            group_name = app.data.groupbar.group.name;
            feature = char(app.BarFeatureDropDown_2.Value);
            
            if class_num == 0
                errordlg('Please add class','error');
            elseif group_num == 0
                errordlg('Please add group','error');
            else
                app.ClearAllButton.ButtonPushedFcn(app,1);
                
                group_bar_data = struct;
                group_bar_data.name = {};
                data_mean = zeros(group_num,class_num);
                data_std  = zeros(group_num,class_num);
                
                for i = 1:class_num
                    eval(['data_name = char(app.data.groupbar.class.' char(class_name(i)) ');']);
                    for j = 1:group_num
                        eval(['var_name = char(app.data.groupbar.group.' char(group_name(j)) ');']);
                        group_bar_data.name(j,i) = {[data_name '_' var_name]};
                        eval(['data_mean(j,i) = app.data.' data_name  '.' var_name '.' feature '.mean;']);
                        eval([' data_std(j,i) = app.data.' data_name  '.' var_name '.' feature '.std;']);
                    end
                end
                
                group_bar_data.mean = data_mean;
                group_bar_data.std  = data_std;
                
                [file, path]=uiputfile('AnaGroupBarData.mat','Save data name');
                if ~(isequal(file,0))  
                    save(fullfile(path, file),'group_bar_data');
                end
                
            end
        end

        % Button pushed function: DeleteStepsButton
        function DeleteStepsButtonPushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            data_name_split = strsplit(data_name,'.');
            eval(['name_temp = app.data.' data_name '.name;']);
            
            eval(['processflag = app.data.' data_name '.processFlag;']);
            
            if ~processflag
                errordlg('Please process data first','error');
            else
                
                eval(['step_num = size(app.data.' data_name '.time.stride.each,1);']);
                step_name = {};
                for i = 1:step_num
                    step_name(i) = {['step_' num2str(i)]};
                end
                
                app.StepListBox.Items = step_name;
%                 app.moveui('app.Panel_4_4',326,590,100,10);
                app.ToolTabGroup.SelectedTab = app.StepSelectTab;
                
            end
            
        end

        % Button pushed function: OKButton
        function OKButtonPushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            data_name_split = strsplit(data_name,'.');
            eval(['name_temp = app.data.' data_name '.name;']);
            
            eval(['processflag = app.data.' data_name '.processFlag;']);
%             app.moveui('app.Panel_4_4',1080,590,100,10);
            app.ToolTabGroup.SelectedTab = app.LoadTab;
            
            if ~processflag
                errordlg('Please process data first','error');
            else
                
                step_del_value = app.StepListBox.Value;
                
                if isempty(step_del_value)
                    msgbox('No Delete');
                else
                    
                    eval(['var_name = app.data.' data_name '.name;'])
                    
                    step_del_num = length(step_del_value);
                    step_del_list = zeros(1,length(step_del_value));
                    
                    for i = 1:step_del_num
                        step_del_value_this = regexp(step_del_value{i},'\d*','match');
                        step_del_list(i) = str2double(step_del_value_this);
                    end
                    
                    for i = 1:length(var_name)
                        
                        eval(['data_temp = app.data.' data_name '.' var_name{i} ';'])
                        disp(var_name{i})
                    
                        data_stride = data_temp.stride.each;
                        disp(step_del_list);
                        data_stride(step_del_list,:) = [];
                        
                        data_temp.stride.each = data_stride;
                        data_temp.stride.mean = mean(data_stride,1);
                        if size(data_stride,1) == 1
                            data_temp.stride.std = zeros(1,size(data_stride,2));
                        else
                            data_temp.stride.std = std(data_stride,1);
                        end
                        
                        rms_feature = rms(data_stride,2)';
                        data_temp.rms.each = rms_feature;
                        data_temp.rms.mean = mean(rms_feature);
                        data_temp.rms.std = std(rms_feature);
                        data_temp.rms.max = max(rms_feature);
                        data_temp.rms.min = min(rms_feature);
                        
                        mean_feature = mean(data_stride,2)';
                        data_temp.mean.each = mean_feature;
                        data_temp.mean.mean = mean(mean_feature);
                        data_temp.mean.std = std(mean_feature);
                        data_temp.mean.max = max(mean_feature);
                        data_temp.mean.min = min(mean_feature);
                        
                        max_feature = max(data_stride')';
                        data_temp.max.each = max_feature;
                        data_temp.max.mean = mean(max_feature);
                        data_temp.max.std = std(max_feature);
                        data_temp.max.max = max(max_feature);
                        data_temp.max.min = min(max_feature);
                        
                        min_feature = min(data_stride')';
                        data_temp.min.each = min_feature;
                        data_temp.min.mean = mean(min_feature);
                        data_temp.min.std = std(min_feature);
                        data_temp.min.max = max(min_feature);
                        data_temp.min.min = min(min_feature);
                        
                        eval(['app.data.' data_name '.' var_name{i} ' = data_temp;'])
                        
                    end
                    msgbox('Delete Success');
                end
                
            end
        end

        % Button pushed function: CANCELButton
        function CANCELButtonPushed(app, event)
%             app.moveui('app.Panel_4_4',1080,590,100,10);
            app.ToolTabGroup.SelectedTab = app.LoadTab;
        end

        % Button pushed function: DiveideScanButton
        function DiveideScanButtonPushed(app, event)
            
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            data_name_split = strsplit(data_name,'.');
            eval(['name_temp = app.data.' data_name '.name;']);
            
            if strcmp(data_name_split{1}, 'dspace')
                if ismember(1,strcmp(name_temp, 'scan_step'))
                    eval(['scan_step = app.data.' data_name '.scan_step.origin;']);
                    if ~isempty(find(scan_step>0,1))
                        
                        scan_index = [];
                        
                        for i = 1:length(scan_step)-1
                            if scan_step(i) ~= scan_step(i+1)
                                scan_index = [scan_index, i];
                            end
                        end
                        
                        for ii = 1:length(scan_index)-1
                            data_name_scan = [data_name '_Scan_Mode_' num2str(ii)];
                            for i = 1:length(name_temp)
                                eval(['var_data = app.data.' data_name '.' char(name_temp(i)) '.origin;']);
                                eval(['app.data.' data_name_scan '.' char(name_temp(i)) '.origin = var_data((scan_index(ii)-10):(scan_index(ii+1)+10));']);
                            end
                            eval(['app.data.' data_name_scan '.name = name_temp;']);
                            eval(['app.data.' data_name_scan '.processFlag = false;']);
                            
                            if isempty(app.data.name)
                                app.data.name = {data_name_scan};
                            else
                                app.data.name(end+1) = {data_name_scan};
                            end
                        end
                        
                        for i = 1:length(app.data.name)
                            if strcmp(app.data.name(i),data_name)
                                app.data.name(i) = [];
                                break;
                            end
                        end
                        
                        data_name = strsplit(data_name,'.');
                        eval(['app.data.' data_name{1} ' = rmfield(app.data.' data_name{1} ', ''' data_name{2} ''');']);
                        app.DataListBox.Items = app.data.name;
                        
                        app.updateVarTable();

                    end
                end
            end
        end

        % Button pushed function: NEWSubButton
        function NEWSubButtonPushed(app, event)
            Row_num = str2num(char(app.SubRowDropDown.Value));
            Col_num = str2num(char(app.SubColDropDown.Value));
            app.setting.subplot_col = Col_num;
            app.setting.subplot_row = Row_num;
            figure('position',[0,app.setting.screen(2)-565,800,480]);
            for i = 1:app.setting.subplot_row
                for j = 1:app.setting.subplot_col
                    subplot(app.setting.subplot_row,app.setting.subplot_col,(i-1)*app.setting.subplot_col+j);
                    app.userfig = gca;
                    hold on;
                    h = gca;
                    h.Box = 'off';
                    h.FontName = 'Times New Roman';
                    h.FontSize = 14;
                    h = gcf;
                    h.Color = [1,1,1];
                end
            end
            app.userpl = struct;
        end

        % Button pushed function: SelectButton
        function SelectButtonPushed(app, event)
            Row_num = str2num(char(app.SubRowDropDown.Value));
            Col_num = str2num(char(app.SubColDropDown.Value));
            subplot(app.setting.subplot_row,app.setting.subplot_col,(Row_num-1)*app.setting.subplot_col+Col_num);
            app.userfig = gca;
        end

        % Callback function
        function TRAJETOPTButtonPushed(app, event)
            app.AnaDataGroup.SelectedTab = app.PLOTALLTab;
            app.PlotGroup.SelectedTab = app.OPTTab;
            app.DataListBox.Items = app.data.name;
            app.updateKeyVarTable();
        end

        % Button pushed function: ALTERStridePlotButton_3
        function ALTERStridePlotButton_3Pushed(app, event)
            
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.VariableListBox.Value);
            linewidth = char(app.LineWidthDropDown.Value);
            linetype = char(app.LineTypeDropDown.Value);
            markersize = char(app.MarkerSizeDropDown.Value);
            markertype = char(app.MarkerTypeDropDown.Value);
%             colordata = app.setting.usercolor;
            
            stepinterval = str2num(char(app.IntervalStepsDropDown.Value));
            stride_percent = 0:0.1:100;
            
            eval(['processflag = app.data.' data_name '.processFlag;']);
            
            if ~processflag
                errordlg('Please process data first','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            elseif isempty(var_name)
                errordlg('Please select a variable','error');
            else
                eval(['data_temp =   app.data.' data_name '.' var_name '.stride;']);
                
                if app.ReverseCheckBox.Value == 1
                    stride_data = -data_temp.each;
                else
                    stride_data = data_temp.each;
                end
                
                datalen = size(stride_data,1);
                plotlen = 1+floor((datalen-1)/stepinterval);
                linewidth = char(app.LineWidthDropDown.Value);
                colorname = char(app.ColorMapDropDown.Value);
                colordata = app.othercolor(colorname,plotlen);
                for stride_index = 1:stepinterval:datalen
                    eval(['p = plot(app.userfig, stride_percent, stride_data(stride_index,:),''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''Marker'',''' markertype ''',''MarkerSize'',' markersize ',''color'', colordata(1+floor((stride_index-1)/stepinterval),:) );']);
                    pl_num = length(fieldnames(app.userpl));
                    eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                end
            end
        end

        % Button pushed function: ALTERStridePlotButton_4
        function ALTERStridePlotButton_4Pushed(app, event)
            
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.VariableListBox.Value);
            linewidth = char(app.LineWidthDropDown.Value);
            linetype = char(app.LineTypeDropDown.Value);
            markersize = char(app.MarkerSizeDropDown.Value);
            markertype = char(app.MarkerTypeDropDown.Value);
            colordata = app.setting.usercolor;
            
            stepinterval = str2num(char(app.StepsDropDown.Value));
            colortype = char(app.LinecolorDropDown.Value);
            plottype = char(app.PlotTypeDropDown.Value);
            stride_percent = 0:0.1:100;
            
            eval(['processflag = app.data.' data_name '.processFlag;']);
            
            if ~processflag
                errordlg('Please process data first','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            elseif isempty(var_name)
                errordlg('Please select a variable','error');
            else
                eval(['data_temp =   app.data.' data_name '.' var_name '.stride;']);
                
                if app.ReverseCheckBox.Value == 1
                    stride_data = -data_temp.each;
                else
                    stride_data = data_temp.each;
                end
                
                [peak_torque,peak_time] = max(stride_data');
                peak_time = peak_time/10;
                
                peak_torque = smooth(peak_torque,stepinterval);
                peak_time = smooth(peak_time,stepinterval);
                datalen = size(stride_data,1);
                plotlen = 1+floor((datalen-1)/stepinterval);
                linewidth = char(app.LineWidthDropDown.Value);
                
                if strcmp(plottype,'BOTH')
                    if strcmp(colortype,'Changed')
                        colorname = char(app.ColorMapDropDown.Value);
                        colordata = app.othercolor(colorname,plotlen);
                        for stride_index = 1:stepinterval:(datalen-stepinterval)
                            eval(['p = plot(app.userfig, peak_time([stride_index,stride_index+stepinterval]), peak_torque([stride_index,stride_index+stepinterval]),''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''Marker'',''' markertype ''',''MarkerSize'',' markersize ',''color'', colordata(1+floor((stride_index-1)/stepinterval),:) );']);
                            pl_num = length(fieldnames(app.userpl));
                            eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                        end
                    else
                        eval(['p = plot(app.userfig, peak_time(1:stepinterval:datalen), peak_torque(1:stepinterval:datalen),''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''Marker'',''' markertype ''',''MarkerSize'',' markersize ',''color'', colordata );']);
                        pl_num = length(fieldnames(app.userpl));
                        eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                    end
                elseif strcmp(plottype,'PeakTime')
                    eval(['p = plot(app.userfig, (1:stepinterval:datalen), peak_time(1:stepinterval:datalen),''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''Marker'',''' markertype ''',''MarkerSize'',' markersize ',''color'', colordata );']);
                    pl_num = length(fieldnames(app.userpl));
                    eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                elseif strcmp(plottype,'PeakTorque')
                    eval(['p = plot(app.userfig, (1:stepinterval:datalen), peak_torque(1:stepinterval:datalen),''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''Marker'',''' markertype ''',''MarkerSize'',' markersize ',''color'', colordata );']);
                    pl_num = length(fieldnames(app.userpl));
                    eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                end
                
            end
        end

        % Button pushed function: Lamp
        function LampPushed3(app, event)
            app.setting.usercolor = uisetcolor(app.setting.usercolor);
            app.Lamp.BackgroundColor = app.setting.usercolor;
        end

        % Button pushed function: Button
        function Button_2Pushed2(app, event)
            colormapname = app.ColorMapDropDown.Value;
            colordata = app.othercolor(colormapname,0);
            colornum = size(colordata,1);
            
            if app.setting.ColorIndex >= colornum
                app.setting.ColorIndex = 1;
            elseif app.setting.ColorIndex == 0
                app.setting.ColorIndex = 1;
            else
                app.setting.ColorIndex = app.setting.ColorIndex + 1;
            end
            
            app.setting.usercolor = colordata(app.setting.ColorIndex,:);
            app.Lamp.BackgroundColor = app.setting.usercolor;
        end

        % Button pushed function: ALTERStridePlotButton_5
        function ALTERStridePlotButton_5Pushed(app, event)
            
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.VariableListBox.Value);
            linewidth = char(app.LineWidthDropDown.Value);
            linetype = char(app.LineTypeDropDown.Value);
            markersize = char(app.MarkerSizeDropDown.Value);
            markertype = char(app.MarkerTypeDropDown.Value);
            colordata = app.setting.usercolor;
            
            stepnum = str2num(char(app.StepsNumDropDown.Value));
            averagenum = str2num(char(app.AverageNumDropDown.Value));
            stride_percent = 0:0.1:100;
            
            eval(['processflag = app.data.' data_name '.processFlag;']);
            
            if ~processflag
                errordlg('Please process data first','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            elseif isempty(var_name)
                errordlg('Please select a variable','error');
            else
                eval(['data_temp =   app.data.' data_name '.' var_name '.stride;']);
                
                if app.ReverseCheckBox.Value == 1
                    stride_data = -data_temp.each;
                else
                    stride_data = data_temp.each;
                end
                
                if stepnum > averagenum + 1
                    steplist = (stepnum-averagenum):stepnum;
                else
                    steplist = stepnum:stepnum+averagenum;
                end

                eval(['p = plot(app.userfig, stride_percent, mean(stride_data(steplist,:)),''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''Marker'',''' markertype ''',''MarkerSize'',' markersize ',''color'', colordata );']);
                pl_num = length(fieldnames(app.userpl));
                eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);

            end
        end

        % Button pushed function: UpdateButton
        function UpdateButtonPushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            data_name_split = strsplit(data_name,'.');
            eval(['name_temp = app.data.' data_name '.name;']);
            
            eval(['processflag = app.data.' data_name '.processFlag;']);
            
            if ~processflag
                errordlg('Please process data first','error');
            else
                
                eval(['step_num = size(app.data.' data_name '.time.stride.each,1);']);
                step_name = {};
                for i = 1:step_num
                    step_name(i) = {num2str(i)};
                end
                
                app.StepsNumDropDown.Items = step_name;
                
            end
        end

        % Callback function
        function Image2Clicked(app, event)
            app.moveui('app.Panel_1',0,6,30,30);
        end

        % Callback function
        function Image2_2Clicked(app, event)
            app.moveui('app.Panel_1',-90,6,30,30);
        end

        % Callback function
        function Image3_2Clicked(app, event)
            app.moveui('app.Panel_4',1080,590,200,10);
            app.moveui('app.Panel_6',1080,590,200,10);
            app.moveui('app.Panel_5',296,590,200,10);
        end

        % Callback function
        function Image3_4Clicked(app, event)
            app.moveui('app.Panel_5',1080,590,200,10);
            app.moveui('app.Panel_6',1080,590,200,10);
            app.moveui('app.Panel_4',296,590,200,10);
        end

        % Callback function
        function Image3_3Clicked(app, event)
            app.moveui('app.Panel_4',1080,590,200,10);
            app.moveui('app.Panel_5',1080,590,200,10);
            app.moveui('app.Panel_6',296,590,200,10);
        end

        % Callback function
        function Image2_3Clicked(app, event)
            app.moveui('app.Panel_3',35,-520,10,200);
            app.moveui('app.Panel_2',35,30,10,200);
        end

        % Callback function
        function Image2_4Clicked(app, event)
            app.moveui('app.Panel_2',35,-520,10,200);
            app.moveui('app.Panel_3',35,30,10,200);
        end

        % Value changed function: KeyVariableListBox
        function KeyVariableListBoxValueChanged(app, event)
            value = app.KeyVariableListBox.Value;
%             if ~isempty(value)
                app.VariableListBox.Value = value;
%             end
        end

        % Callback function
        function LOADDATAButton_2Pushed(app, event)
            app.moveui('app.Panel_1',0,6,30,30);
        end

        % Callback function
        function LOADDATAButton_3Pushed(app, event)
            app.moveui('app.Panel_1',-90,6,30,30);
        end

        % Button pushed function: SearchButton
        function SearchButtonPushed(app, event)
            app.moveui('app.Panel_3',35,-520,10,200);
            app.moveui('app.Panel_2',25,30,220,480);
        end

        % Button pushed function: ListButton
        function ListButtonPushed(app, event)
            app.moveui('app.Panel_2',35,-520,10,200);
            app.moveui('app.Panel_3',25,30,220,480);
        end

        % Callback function
        function LOADDATAButton_9Pushed(app, event)
            app.moveui('app.Panel_5',1080,590,200,10);
            app.moveui('app.Panel_6',1080,590,200,10);
            app.moveui('app.Panel_4',296,590,200,10);
        end

        % Callback function
        function LOADDATAButton_11Pushed(app, event)
            app.moveui('app.Panel_4',1080,590,200,10);
            app.moveui('app.Panel_5',1080,590,200,10);
            app.moveui('app.Panel_6',296,590,200,10);
        end

        % Callback function
        function LOADDATAButton_12Pushed(app, event)
            app.moveui('app.Panel_5',1080,590,200,10);
            app.moveui('app.Panel_6',1080,590,200,10);
            app.moveui('app.Panel_4',296,590,200,10);
        end

        % Callback function
        function LOADDATAButton_13Pushed(app, event)
            app.moveui('app.Panel_4',1080,590,200,10);
            app.moveui('app.Panel_6',1080,590,200,10);
            app.moveui('app.Panel_5',296,590,200,10);
        end

        % Button pushed function: GROUPPLOTButton
        function VarAlterPlotButton_4Pushed(app, event)
            
            class_num = length(app.data.groupbar.class.name);
            class_name = app.data.groupbar.class.name;
            var_name = char(app.VariableListBox.Value);
            
            colormapname = app.ColorMapDropDown.Value;
            colordata = app.othercolor(colormapname,class_num);

            linewidth = char(app.LineWidthDropDown.Value);
            linetype = char(app.LineTypeDropDown.Value);
            markersize = char(app.MarkerSizeDropDown.Value);
            markertype = char(app.MarkerTypeDropDown.Value);
            
            stride_percent = 0:0.1:100;
            
            if class_num == 0
                errordlg('Please add class','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            else
                
                for i = 1:class_num
                    eval(['data_name = char(app.data.groupbar.class.' char(class_name(i)) ');']);
                    eval(['data_mean =   app.data.' data_name '.' var_name '.stride.mean;']);
                    
                    eval(['p = plot(app.userfig, stride_percent, data_mean'',''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''Marker'',''' markertype ''',''MarkerSize'',' markersize ',''color'', colordata(i,:));']);
                    pl_num = length(fieldnames(app.userpl));
                    eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                    
                end
                
            
            end
            
        end

        % Button pushed function: Button_3
        function Button_3Pushed(app, event)
            colormapname = app.ColorMapDropDown.Value;
            colordata = app.othercolor(colormapname,0);
            colornum = size(colordata,1);
            
            if app.setting.ColorIndex == 0
                app.setting.ColorIndex = 1;
            elseif app.setting.ColorIndex <= 1
                app.setting.ColorIndex = colornum;
            else
                app.setting.ColorIndex = app.setting.ColorIndex - 1;
            end
            
            app.setting.usercolor = colordata(app.setting.ColorIndex,:);
            app.Lamp.BackgroundColor = app.setting.usercolor;
        end

        % Button pushed function: FITTINGButton
        function FITTINGButtonPushed(app, event)
%             app.moveui('app.Panel_7',276,-576,10,200);
%             app.moveui('app.Panel_8',276,-576,10,200);
%             app.moveui('app.Panel_13',276,-576,10,200);
% %             app.moveui('app.Panel_2',35,30,10,200);
%             app.moveui('app.Panel_12',276,2,10,200);
%             app.moveui('app.Panel_4',1080,590,200,10);
%             app.moveui('app.Panel_6',1080,590,200,10);
%             app.moveui('app.Panel_5',296,590,200,10);
            for i = 1:length(app.PlotButtonGroup.Children)
                app.PlotButtonGroup.Children(i).BackgroundColor = app.setting.backcolorset.defult(1,:);
            end
            app.FITTINGButton.BackgroundColor = app.setting.backcolorset.defult(2,:);
            
            app.PlotGroup.SelectedTab = app.FitTab;
            app.DataListBox.Items = app.data.name;
            app.updateKeyVarTable();
        end

        % Button pushed function: ClassAddButton_4
        function ClassAddButton_2Pushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.VariableListBox.Value);
            feature = char(app.FitFeatureDropDown.Value);

            eval(['processflag = app.data.' data_name '.processFlag;']);
            
            if ~processflag
                errordlg('Please process data first','error');
            else
                eval(['feature_data = app.data.' data_name '.' var_name '.' feature '.mean;']);
                if isempty(app.FittingTable.Data)
                    app.FittingTable.Data = {[data_name '-' var_name '-' feature],[feature_data],[],[]};
                else
                    app.FittingTable.Data(end+1,:) = {[data_name '-' var_name '-' feature],[feature_data],[],[]};
                end
            end
        end

        % Button pushed function: ClassDeleteButton_4
        function ClassDeleteButton_2Pushed(app, event)
            app.FittingTable.Data(app.data.fit.selectedRow,:) = [];
        end

        % Button pushed function: ClassClearButton_4
        function ClassClearButton_2Pushed(app, event)
            app.FittingTable.Data = [];
        end

        % Callback function
        function FittingButton1Pushed(app, event)
            fitdata = cell2mat(app.FittingTable.Data(:,2));
            dataX = [];
            for i = 1:length(app.FittingTable.Data(:,3))
                dataX(i,1) = str2double(app.FittingTable.Data(i,3));
            end
            fitmethod = app.FittingMethodDropDown1.Value;
            linewidth = char(app.LineWidthDropDown.Value);
            linetype = char(app.LineTypeDropDown.Value);
            markersize = char(app.MarkerSizeDropDown.Value);
            markertype = char(app.MarkerTypeDropDown.Value);
            colordata = app.setting.usercolor;
            
            if length(fitdata) ~=  length(dataX)
                errordlg('Please complete LabelX data','error');
            elseif isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            else
                xi = linspace(1.2*min(dataX) - 0.2*max(dataX),1.2*max(dataX)-0.2*min(dataX),100)';
                yi = interp1(dataX,fitdata,xi,fitmethod);
                eval(['p = plot(app.userfig, xi, yi,''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''color'', colordata);']);
                pl_num = length(fieldnames(app.userpl));
                eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                eval(['p = plot(app.userfig, dataX, fitdata,''.k'',''MarkerSize'',' markersize ');']);
                pl_num = length(fieldnames(app.userpl));
                eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
            end

        end

        % Cell selection callback: FittingTable
        function FittingTableCellSelection(app, event)
            indices = event.Indices;
            app.data.fit.selectedRow = indices(1);
        end

        % Button pushed function: FittingButton1
        function FittingButton1Pushed2(app, event)
            fitdata = cell2mat(app.FittingTable.Data(:,2));
            dataX = [];
            for i = 1:length(app.FittingTable.Data(:,3))
                dataX(i,1) = str2double(app.FittingTable.Data(i,3));
            end
            fitmethod = app.FittingMethodDropDown1.Value;
            linewidth = char(app.LineWidthDropDown.Value);
            linetype = char(app.LineTypeDropDown.Value);
            markersize = char(app.MarkerSizeDropDown.Value);
            markertype = char(app.MarkerTypeDropDown.Value);
            colordata = app.setting.usercolor;
            
            if length(fitdata) ~=  length(dataX)
                errordlg('Please complete LabelX data','error');
            else
                [f,eva]=fit(dataX,fitdata,fitmethod);
                xi = linspace(1.2*min(dataX) - 0.2*max(dataX),1.2*max(dataX)-0.2*min(dataX),100)';
                yi = feval(f,xi);
                
%                 plot(app.userfig,f);
%                 plot(f,dataX,fitdata);
                eval(['p = plot(app.userfig, xi, yi,''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''color'', colordata);']);
                pl_num = length(fieldnames(app.userpl));
                eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                eval(['p = plot(app.userfig, dataX, fitdata,''.k'',''MarkerSize'',' markersize ');']);
                pl_num = length(fieldnames(app.userpl));
                eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
                title(['Fitting R^2 = ' num2str(eva.rsquare)]);
            end
        end

        % Button pushed function: FittingButton2
        function FittingButton2Pushed(app, event)
            fitdata = cell2mat(app.FittingTable.Data(:,2));
            dataX = [];
            for i = 1:length(app.FittingTable.Data(:,3))
                if isempty(app.FittingTable.Data(i,3))
                    errordlg('Please complete LabelX data','error');
                    return;
                else
                    dataX(i,1) = str2double(app.FittingTable.Data(i,3));
                end
            end
            dataY = [];
            for i = 1:length(app.FittingTable.Data(:,4))
                if isempty(app.FittingTable.Data(i,4))
                    errordlg('Please complete LabelY data','error');
                    return;
                else
                    dataY(i,1) = str2double(app.FittingTable.Data(i,4));
                end
            end
            fitmethod = app.FittingMethodDropDown2.Value;
            linewidth = char(app.LineWidthDropDown.Value);
            linetype = char(app.LineTypeDropDown.Value);
            markersize = str2double(app.MarkerSizeDropDown.Value);
            if markersize < 5
                markersize = 8;
            end
            markertype = char(app.MarkerTypeDropDown.Value);
%             colordata = app.setting.usercolor;
            colormapname = app.ColorMapDropDown.Value;
            colordata = app.othercolor(colormapname,markersize);
            
            if length(fitdata) ~=  length(dataX)
                errordlg('Please complete LabelX data','error');
            else
                [f,eva]=fit([dataX,dataY],fitdata,fitmethod,'Normalize',"on");
%                 xi = linspace(1.2*min(dataX) - 0.2*max(dataX),1.2*max(dataX)-0.2*min(dataX),50)';
%                 yi = linspace(1.2*min(dataY) - 0.2*max(dataY),1.2*max(dataY)-0.2*min(dataY),50)';
%                 [X,Y] = meshgrid(xi,yi);
%                 
%                 Z = feval(f,X,Y);
                
                figure;
                s = plot(f,[dataX,dataY],fitdata);
                colormap(colordata);
                s(2)
                s(1).EdgeColor = 'none';
                s(1).FaceColor = 'interp';
                s(2).MarkerFaceColor = 'k';
                view(2);
                title(['Fitting R^2 = ' num2str(eva.rsquare)]);
                
%                 s = surface(app.userfig,X,Y,Z,'FaceAlpha',0.8,'FaceColor',"interp");
%                 scatter3(app.userfig,dataX,dataY,fitdata,'filled','MarkerFaceColor','k');
                
%                 plot(app.userfig,f);
%                 plot(f,dataX,fitdata);
%                 eval(['p = plot(app.userfig, xi, yi,''LineStyle'',''' linetype ''',''LineWidth'',' linewidth ',''color'', colordata);']);
%                 pl_num = length(fieldnames(app.userpl));
%                 eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
%                 eval(['p = plot(app.userfig, dataX, fitdata,''.k'',''MarkerSize'',' markersize ');']);
%                 pl_num = length(fieldnames(app.userpl));
%                 eval(['app.userpl.p' num2str(pl_num+1) ' = p;']);
%                 title(['Fitting R^2 = ' num2str(eva.rsquare)]);
            end
        end

        % Button pushed function: ALTERNEWButton_10
        function ALTERNEWButton_8Pushed(app, event)
            
            dataZ = cell2mat(app.FittingTable.Data(:,2));
            dataX = [];
            for i = 1:length(app.FittingTable.Data(:,3))
                if isempty(app.FittingTable.Data(i,3))
                    errordlg('Please complete LabelX data','error');
                    return;
                else
                    dataX(i,1) = str2double(app.FittingTable.Data(i,3));
                end
            end
            dataY = [];
            for i = 1:length(app.FittingTable.Data(:,4))
                if isempty(app.FittingTable.Data(i,4))
                    errordlg('Please complete LabelY data','error');
                    return;
                else
                    dataY(i,1) = str2double(app.FittingTable.Data(i,4));
                end
            end
            [file, path]=uiputfile('AnaFitData.mat','Save data name');
            if ~(isequal(file,0))  
                save(fullfile(path, file),"dataX","dataY","dataZ");
            end
        end

        % Button pushed function: SIGNFIButton
        function SIGNFIButtonPushed(app, event)
%             app.moveui('app.Panel_7',276,-576,10,200);
%             app.moveui('app.Panel_8',276,-576,10,200);
%             app.moveui('app.Panel_12',276,-576,10,200);
% %             app.moveui('app.Panel_2',35,30,10,200);
%             app.moveui('app.Panel_13',276,2,10,200);
%             app.moveui('app.Panel_4',1080,590,200,10);
%             app.moveui('app.Panel_6',1080,590,200,10);
%             app.moveui('app.Panel_5',296,590,200,10);
            for i = 1:length(app.PlotButtonGroup.Children)
                app.PlotButtonGroup.Children(i).BackgroundColor = app.setting.backcolorset.defult(1,:);
            end
            app.SIGNFIButton.BackgroundColor = app.setting.backcolorset.defult(2,:);
            
            app.PlotGroup.SelectedTab = app.SignifTab;
            app.DataListBox.Items = app.data.name;
            app.updateKeyVarTable();
        end

        % Button pushed function: AddGroupButton
        function AddGroupButtonPushed(app, event)
            new_name = char(inputdlg('Input the new group name：','Creat Group'));
                if ~isempty(new_name)
                    if isempty(app.SigTable.Data)
                        app.SigTable.Data = {[new_name],[]};
                        app.data.sig.name = {[new_name]};
                        eval(['app.data.sig.' new_name ' = [];']);
                        app.data.sig.selectedGroup = new_name;
                        app.updateGroupData();
                    else
                        app.SigTable.Data(end+1,:) = {[new_name],[]};
                        app.data.sig.name(end+1) = {[new_name]};
                        eval(['app.data.sig.' new_name ' = [];']);
                        app.data.sig.selectedGroup = new_name;
                        app.updateGroupData();
                    end
                end
        end

        % Button pushed function: AddDataButton1
        function AddDataButton1Pushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.VariableListBox.Value);
            group_name =app.data.sig.selectedGroup;
            feature = char(app.SigFeatureDropDown.Value);
            
            if ~isempty(app.data.sig.selectedGroup)
                eval(['app.data.sig.' group_name ' = [app.data.sig.' group_name '; app.data.' data_name '.' var_name '.' feature '.mean ];']);
                app.updateGroupData();
            end
        end

        % Cell selection callback: SigTable
        function SigTableCellSelection(app, event)
            indices = event.Indices;
%             app.SigTable.Data{indices(1),1}
            app.data.sig.selectedID = indices(1);
            app.data.sig.selectedGroup = app.SigTable.Data{indices(1),1};
            app.updateGroupData();
            
        end

        % Button pushed function: DeleteGroupButton
        function DeleteGroupButtonPushed(app, event)
            app.SigTable.Data(app.data.sig.selectedID,:) = [];
            eval(['app.data.sig = rmfield(app.data.sig, ''' app.data.sig.selectedGroup ''');']);
            for i = 1:length(app.data.sig.name)
                if strcmp(app.data.sig.name(i),app.data.sig.selectedGroup)
                    app.data.sig.name(i) = [];
                end
            end
            app.data.sig.selectedGroup = [];
            app.updateGroupData();
        end

        % Button pushed function: ClearGroupButton
        function ClearGroupButtonPushed(app, event)
            app.SigTable.Data = {};
            app.data.sig = {};
            app.data.sig.name = {};
            app.data.sig.selectedGroup = [];
            app.data.sig.selectedID = 1;
        end

        % Button pushed function: AddDataButton2
        function AddDataButton2Pushed(app, event)
            data_name = char(app.DataListBox.Value);
            if size(data_name,1) > 1
                data_name = data_name(1,:);
            end
            var_name = char(app.VariableListBox.Value);
            group_name =app.data.sig.selectedGroup;
            feature = char(app.SigFeatureDropDown.Value);
            
            if ~isempty(app.data.sig.selectedGroup)
                eval(['app.data.sig.' group_name ' = [app.data.sig.' group_name '; app.data.' data_name '.' var_name '.' feature '.each'' ];']);
                app.updateGroupData();
            end
        end

        % Button pushed function: AddDataButton2_2
        function AddDataButton2_2Pushed(app, event)
            group_name =app.data.sig.selectedGroup;
            if ~isempty(app.data.sig.selectedGroup)
                eval(['app.data.sig.' group_name ' = [];']);
                app.updateGroupData();
            end
        end

        % Button pushed function: ClassUpButton_4
        function ClassUpButton_2Pushed(app, event)
            if app.data.sig.selectedID > 1
                data_temp = app.SigTable.Data(app.data.sig.selectedID,:);
                app.SigTable.Data(app.data.sig.selectedID,:) = app.SigTable.Data(app.data.sig.selectedID-1,:);
                app.SigTable.Data(app.data.sig.selectedID-1,:) = data_temp;
                app.data.sig.selectedID = app.data.sig.selectedID - 1;
                app.data.sig.selectedGroup = app.SigTable.Data{app.data.sig.selectedID,1};
                app.updateGroupData();
            end
        end

        % Button pushed function: NormalityAnaButton
        function NormalityAnaButtonPushed(app, event)
            if isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            else
                group_name = app.data.sig.selectedGroup;
                eval(['group_data = app.data.sig.' group_name ';']);
                [hp,p] = lillietest(group_data);
                h = histogram(app.userfig,group_data',15);
                h.Normalization = 'probability';
                title(['Normality Test P-Value = ' num2str(p)]);
            end
        end

        % Button pushed function: VarAnaButton
        function VarAnaButtonPushed(app, event)
            
            if isempty(app.userfig) || ~isvalid(app.userfig)
                errordlg('Please create a new figure','error');
            else
                group_num = length(app.data.sig.name);
                all_group_data = [];
                all_group_label = {};
                group_var = [];
                group_label = {};
                
                for i = 1:group_num
                    group_name = app.SigTable.Data{i,1};
                    eval(['group_data = app.data.sig.' group_name ';']);
                    all_group_data = [all_group_data; group_data];
                    group_var = [group_var, std(group_data)];
                    group_label{end+1} = group_name;
                    for j = 1:length(group_data)
                        all_group_label{end+1} = group_name;
                    end
                end
                
                p = vartestn(all_group_data,all_group_label,'off');
                
                b = bar(app.userfig, group_var, 'grouped', 'FaceColor', 'flat');
                set(b,'edgecolor','none');
                set(app.userfig, 'xtick', [1:group_num]');
                set(app.userfig, 'xticklabel', group_label);
                set(app.userfig, 'TickLabelInterpreter', 'none');
                title(['Variance Test P-Value = ' num2str(p)]);
            end
            
        end

        % Button pushed function: VarAnaButton_2
        function VarAnaButton_2Pushed(app, event)
            group_num = length(app.data.sig.name);
            group_name = app.SigTable.Data{1,1};
            eval(['group_data_x = app.data.sig.' group_name ';']);
            app.SigTable.Data{1,2} = '-';
            for i = 2:group_num
                group_name = app.SigTable.Data{i,1};
                eval(['group_data_y = app.data.sig.' group_name ';']);
                [~,p] = ttest2(group_data_x,group_data_y);
                app.SigTable.Data{i,2} = num2str(p);
            end
        end

        % Button pushed function: VarAnaButton_3
        function VarAnaButton_3Pushed(app, event)
            group_num = length(app.data.sig.name);
            all_group_data = [];
            all_group_label = {};
            
            for i = 1:group_num
                group_name = app.SigTable.Data{i,1};
                eval(['group_data = app.data.sig.' group_name ';']);
                all_group_data = [all_group_data; group_data];
                for j = 1:length(group_data)
                    all_group_label{end+1} = group_name;
                end
                app.SigTable.Data{i,2} = '-';
            end
            
            p = anova1(all_group_data,all_group_label);
            app.SigTable.Data{1,2} = num2str(p);
        end

        % Button pushed function: VarAnaButton_5
        function VarAnaButton_5Pushed(app, event)
            group_num = length(app.data.sig.name);
            group_name = app.SigTable.Data{1,1};
            eval(['group_data_x = app.data.sig.' group_name ';']);
            app.SigTable.Data{1,2} = '-';
            for i = 2:group_num
                group_name = app.SigTable.Data{i,1};
                eval(['group_data_y = app.data.sig.' group_name ';']);
                p = ranksum(group_data_x,group_data_y);
                app.SigTable.Data{i,2} = num2str(p);
            end
        end

        % Button pushed function: VarAnaButton_4
        function VarAnaButton_4Pushed(app, event)
            group_num = length(app.data.sig.name);
            all_group_data = [];
            all_group_label = {};
            
            for i = 1:group_num
                group_name = app.SigTable.Data{i,1};
                eval(['group_data = app.data.sig.' group_name ';']);
                all_group_data = [all_group_data; group_data];
                for j = 1:length(group_data)
                    all_group_label{end+1} = group_name;
                end
                app.SigTable.Data{i,2} = '-';
            end
            
            p = kruskalwallis(all_group_data,all_group_label);
            app.SigTable.Data{1,2} = num2str(p);
        end

        % Button pushed function: LoadTabButton
        function LoadTabButtonPushed(app, event)
            app.LoadTabButton.BackgroundColor = app.setting.backcolorset.defult(2,:);
            app.VarEditTabButton.BackgroundColor = app.setting.backcolorset.defult(1,:);
            app.PlotSetTabButton.BackgroundColor = app.setting.backcolorset.defult(1,:);
            app.ToolTabGroup.SelectedTab = app.LoadTab;
        end

        % Button pushed function: VarEditTabButton
        function VarEditTabButtonPushed(app, event)
            app.LoadTabButton.BackgroundColor = app.setting.backcolorset.defult(1,:);
            app.VarEditTabButton.BackgroundColor = app.setting.backcolorset.defult(2,:);
            app.PlotSetTabButton.BackgroundColor = app.setting.backcolorset.defult(1,:);
            app.ToolTabGroup.SelectedTab = app.VarEditTab;
        end

        % Button pushed function: PlotSetTabButton
        function PlotSetTabButtonPushed(app, event)
            app.LoadTabButton.BackgroundColor = app.setting.backcolorset.defult(1,:);
            app.VarEditTabButton.BackgroundColor = app.setting.backcolorset.defult(1,:);
            app.PlotSetTabButton.BackgroundColor = app.setting.backcolorset.defult(2,:);
            app.ToolTabGroup.SelectedTab = app.PlotSetTab;
        end

        % Value changed function: GlobalSettingButton
        function GlobalSettingButtonValueChanged(app, event)
            value = app.GlobalSettingButton.Value;
            app.TabGroup.SelectedTab = app.GlobalSetTab;
        end

        % Button pushed function: SetBalckColor
        function SetBalckColorButtonPushed(app, event)
            app.SetBackGroundSolor(app.setting.backcolorset.dark);
        end

        % Button pushed function: SetBalckColor_2
        function SetBalckColor_2ButtonPushed(app, event)
            app.SetBackGroundSolor(app.setting.backcolorset.blue);
        end

        % Button pushed function: SetBalckColor_3
        function SetBalckColor_3ButtonPushed(app, event)
            app.SetBackGroundSolor(app.setting.backcolorset.green);
        end

        % Button pushed function: SetBalckColor_4
        function SetBalckColor_4ButtonPushed(app, event)
            app.SetBackGroundSolor(app.setting.backcolorset.pink);
        end

        % Button pushed function: SetBalckColor_5
        function SetBalckColor_5ButtonPushed(app, event)
            app.SetBackGroundSolor(app.setting.backcolorset.purple);
        end

        % Callback function
        function MultiSelectButtonPushed(app, event)
            if app.MultiSelectButton.BackgroundColor == app.setting.backcolorset.defult(1,:)
                app.MultiSelectButton.BackgroundColor = app.setting.backcolorset.defult(2,:);
                app.DataListBox.Multiselect = 'on';
            else
                app.MultiSelectButton.BackgroundColor = app.setting.backcolorset.defult(1,:);
                app.DataListBox.Multiselect = 'off';
            end
            
        end
    end

    % Component initialization
    methods (Access = private)

        % Create UIFigure and components
        function createComponents(app)

            % Create DPAS102LabUIFigure and hide until all components are created
            app.DPAS102LabUIFigure = uifigure('Visible', 'off');
            app.DPAS102LabUIFigure.Color = [0.149 0.149 0.149];
            app.DPAS102LabUIFigure.Position = [840 330 1080 720];
            app.DPAS102LabUIFigure.Name = 'DPAS - 102 Lab';

            % Create TabGroup
            app.TabGroup = uitabgroup(app.DPAS102LabUIFigure);
            app.TabGroup.Position = [1 1 1080 745];

            % Create MainTab
            app.MainTab = uitab(app.TabGroup);
            app.MainTab.Title = 'Main';
            app.MainTab.BackgroundColor = [0.149 0.149 0.149];

            % Create LabDataProcessAnalysisSystemLabel
            app.LabDataProcessAnalysisSystemLabel = uilabel(app.MainTab);
            app.LabDataProcessAnalysisSystemLabel.HorizontalAlignment = 'center';
            app.LabDataProcessAnalysisSystemLabel.FontName = 'Calibri';
            app.LabDataProcessAnalysisSystemLabel.FontSize = 72;
            app.LabDataProcessAnalysisSystemLabel.FontWeight = 'bold';
            app.LabDataProcessAnalysisSystemLabel.FontColor = [1 1 1];
            app.LabDataProcessAnalysisSystemLabel.Position = [56 471 968 176];
            app.LabDataProcessAnalysisSystemLabel.Text = {'102 Lab'; 'Data Process & Analysis System'};

            % Create ProcessAnalysisButton
            app.ProcessAnalysisButton = uibutton(app.MainTab, 'state');
            app.ProcessAnalysisButton.ValueChangedFcn = createCallbackFcn(app, @ProcessAnalysisButtonValueChanged, true);
            app.ProcessAnalysisButton.Text = {'Process'; 'Analysis'};
            app.ProcessAnalysisButton.BackgroundColor = [0.2 0.2 0.2];
            app.ProcessAnalysisButton.FontName = 'Calibri';
            app.ProcessAnalysisButton.FontSize = 36;
            app.ProcessAnalysisButton.FontWeight = 'bold';
            app.ProcessAnalysisButton.FontColor = [1 1 1];
            app.ProcessAnalysisButton.Position = [244 216 217 124];

            % Create GlobalSettingButton
            app.GlobalSettingButton = uibutton(app.MainTab, 'state');
            app.GlobalSettingButton.ValueChangedFcn = createCallbackFcn(app, @GlobalSettingButtonValueChanged, true);
            app.GlobalSettingButton.Text = {'Global'; 'Setting'};
            app.GlobalSettingButton.BackgroundColor = [0.2 0.2 0.2];
            app.GlobalSettingButton.FontName = 'Calibri';
            app.GlobalSettingButton.FontSize = 36;
            app.GlobalSettingButton.FontWeight = 'bold';
            app.GlobalSettingButton.FontColor = [1 1 1];
            app.GlobalSettingButton.Position = [611 216 217 124];

            % Create AnaDataTab
            app.AnaDataTab = uitab(app.TabGroup);
            app.AnaDataTab.Title = 'AnaData';
            app.AnaDataTab.BackgroundColor = [0.149 0.149 0.149];

            % Create DataListBox
            app.DataListBox = uilistbox(app.AnaDataTab);
            app.DataListBox.Items = {'NULL'};
            app.DataListBox.Multiselect = 'on';
            app.DataListBox.ValueChangedFcn = createCallbackFcn(app, @DataListBoxValueChanged2, true);
            app.DataListBox.FontName = 'Calibri';
            app.DataListBox.FontSize = 16;
            app.DataListBox.FontColor = [1 1 1];
            app.DataListBox.BackgroundColor = [0.502 0.502 0.502];
            app.DataListBox.Position = [30 518 210 173];
            app.DataListBox.Value = {'NULL'};

            % Create DataLabel
            app.DataLabel = uilabel(app.AnaDataTab);
            app.DataLabel.VerticalAlignment = 'top';
            app.DataLabel.FontName = 'Calibri';
            app.DataLabel.FontSize = 26;
            app.DataLabel.FontColor = [1 1 1];
            app.DataLabel.Position = [30 690 55 35];
            app.DataLabel.Text = 'Data';

            % Create Panel_2
            app.Panel_2 = uipanel(app.AnaDataTab);
            app.Panel_2.BorderType = 'none';
            app.Panel_2.BackgroundColor = [0.149 0.149 0.149];
            app.Panel_2.Position = [25 30 220 480];

            % Create KeyVariableListBox
            app.KeyVariableListBox = uilistbox(app.Panel_2);
            app.KeyVariableListBox.Items = {};
            app.KeyVariableListBox.ValueChangedFcn = createCallbackFcn(app, @KeyVariableListBoxValueChanged, true);
            app.KeyVariableListBox.FontName = 'Calibri';
            app.KeyVariableListBox.FontSize = 18;
            app.KeyVariableListBox.FontColor = [1 1 1];
            app.KeyVariableListBox.BackgroundColor = [0.502 0.502 0.502];
            app.KeyVariableListBox.Position = [6 15 210 418];
            app.KeyVariableListBox.Value = {};

            % Create EditKey
            app.EditKey = uieditfield(app.Panel_2, 'text');
            app.EditKey.ValueChangedFcn = createCallbackFcn(app, @EditKeyValueChanged, true);
            app.EditKey.FontName = 'Calibri';
            app.EditKey.FontSize = 18;
            app.EditKey.Position = [6 445 210 28];
            app.EditKey.Value = 'NULL';

            % Create Panel_3
            app.Panel_3 = uipanel(app.AnaDataTab);
            app.Panel_3.BorderType = 'none';
            app.Panel_3.BackgroundColor = [0.149 0.149 0.149];
            app.Panel_3.Position = [25 30 220 480];

            % Create VariableListBox
            app.VariableListBox = uilistbox(app.Panel_3);
            app.VariableListBox.Items = {'NULL'};
            app.VariableListBox.FontName = 'Calibri';
            app.VariableListBox.FontSize = 16;
            app.VariableListBox.FontColor = [1 1 1];
            app.VariableListBox.BackgroundColor = [0.502 0.502 0.502];
            app.VariableListBox.Position = [6 15 209 418];
            app.VariableListBox.Value = 'NULL';

            % Create VariableLabel
            app.VariableLabel = uilabel(app.Panel_3);
            app.VariableLabel.VerticalAlignment = 'top';
            app.VariableLabel.FontName = 'Calibri';
            app.VariableLabel.FontSize = 26;
            app.VariableLabel.FontColor = [1 1 1];
            app.VariableLabel.Position = [6 442 91 35];
            app.VariableLabel.Text = 'Variable';

            % Create SearchButton
            app.SearchButton = uibutton(app.AnaDataTab, 'push');
            app.SearchButton.ButtonPushedFcn = createCallbackFcn(app, @SearchButtonPushed, true);
            app.SearchButton.Icon = 'search1.png';
            app.SearchButton.IconAlignment = 'center';
            app.SearchButton.BackgroundColor = [0.349 0.349 0.349];
            app.SearchButton.FontName = 'Calibri';
            app.SearchButton.FontSize = 18;
            app.SearchButton.FontColor = [1 1 1];
            app.SearchButton.Tooltip = {'Add Data'};
            app.SearchButton.Position = [120 0 30 30];
            app.SearchButton.Text = '';

            % Create ListButton
            app.ListButton = uibutton(app.AnaDataTab, 'push');
            app.ListButton.ButtonPushedFcn = createCallbackFcn(app, @ListButtonPushed, true);
            app.ListButton.Icon = 'list.png';
            app.ListButton.IconAlignment = 'center';
            app.ListButton.BackgroundColor = [0.349 0.349 0.349];
            app.ListButton.FontName = 'Calibri';
            app.ListButton.FontSize = 18;
            app.ListButton.FontColor = [1 1 1];
            app.ListButton.Tooltip = {'Add Data'};
            app.ListButton.Position = [164 0 30 30];
            app.ListButton.Text = '';

            % Create PlotGroup
            app.PlotGroup = uitabgroup(app.AnaDataTab);
            app.PlotGroup.TabLocation = 'right';
            app.PlotGroup.Position = [296 0 870 574];

            % Create PlotTab
            app.PlotTab = uitab(app.PlotGroup);
            app.PlotTab.Title = 'PlotTab';
            app.PlotTab.BackgroundColor = [0.149 0.149 0.149];
            app.PlotTab.ForegroundColor = [0.149 0.149 0.149];

            % Create TIMEPLOTPanel
            app.TIMEPLOTPanel = uipanel(app.PlotTab);
            app.TIMEPLOTPanel.ForegroundColor = [1 1 1];
            app.TIMEPLOTPanel.BorderType = 'none';
            app.TIMEPLOTPanel.TitlePosition = 'centertop';
            app.TIMEPLOTPanel.Title = 'TIME PLOT';
            app.TIMEPLOTPanel.BackgroundColor = [0.251 0.251 0.251];
            app.TIMEPLOTPanel.FontName = 'Calibri';
            app.TIMEPLOTPanel.FontSize = 20;
            app.TIMEPLOTPanel.Position = [26 433 341 120];

            % Create TIMEPLOTButton
            app.TIMEPLOTButton = uibutton(app.TIMEPLOTPanel, 'push');
            app.TIMEPLOTButton.ButtonPushedFcn = createCallbackFcn(app, @TIMEPLOTButtonPushed, true);
            app.TIMEPLOTButton.BackgroundColor = [0.251 0.251 0.251];
            app.TIMEPLOTButton.FontName = 'Calibri';
            app.TIMEPLOTButton.FontSize = 18;
            app.TIMEPLOTButton.FontColor = [1 1 1];
            app.TIMEPLOTButton.Position = [137 22 70 50];
            app.TIMEPLOTButton.Text = 'PLOT';

            % Create FEATUREPLOTPanel
            app.FEATUREPLOTPanel = uipanel(app.PlotTab);
            app.FEATUREPLOTPanel.ForegroundColor = [1 1 1];
            app.FEATUREPLOTPanel.BorderType = 'none';
            app.FEATUREPLOTPanel.TitlePosition = 'centertop';
            app.FEATUREPLOTPanel.Title = 'FEATURE PLOT';
            app.FEATUREPLOTPanel.BackgroundColor = [0.251 0.251 0.251];
            app.FEATUREPLOTPanel.FontName = 'Calibri';
            app.FEATUREPLOTPanel.FontSize = 20;
            app.FEATUREPLOTPanel.Position = [393 433 368 120];

            % Create FEATUREPLOTButton
            app.FEATUREPLOTButton = uibutton(app.FEATUREPLOTPanel, 'push');
            app.FEATUREPLOTButton.ButtonPushedFcn = createCallbackFcn(app, @FEATUREPLOTButtonPushed, true);
            app.FEATUREPLOTButton.BackgroundColor = [0.251 0.251 0.251];
            app.FEATUREPLOTButton.FontName = 'Calibri';
            app.FEATUREPLOTButton.FontSize = 18;
            app.FEATUREPLOTButton.FontColor = [1 1 1];
            app.FEATUREPLOTButton.Position = [230 24 80 50];
            app.FEATUREPLOTButton.Text = 'SCATTER';

            % Create FeatureDropDown_5Label
            app.FeatureDropDown_5Label = uilabel(app.FEATUREPLOTPanel);
            app.FeatureDropDown_5Label.BackgroundColor = [0.251 0.251 0.251];
            app.FeatureDropDown_5Label.HorizontalAlignment = 'center';
            app.FeatureDropDown_5Label.FontName = 'Calibri';
            app.FeatureDropDown_5Label.FontSize = 18;
            app.FeatureDropDown_5Label.FontColor = [1 1 1];
            app.FeatureDropDown_5Label.Position = [61 51 61 24];
            app.FeatureDropDown_5Label.Text = 'Feature';

            % Create FeatureDropDown
            app.FeatureDropDown = uidropdown(app.FEATUREPLOTPanel);
            app.FeatureDropDown.Items = {'rms', 'mean', 'max', 'min', 'pt', 'meanP', 'maxP', 'pos_mean', 'neg_mean'};
            app.FeatureDropDown.FontName = 'Calibri';
            app.FeatureDropDown.FontSize = 18;
            app.FeatureDropDown.FontColor = [1 1 1];
            app.FeatureDropDown.BackgroundColor = [0.251 0.251 0.251];
            app.FeatureDropDown.Position = [141 52 61 25];
            app.FeatureDropDown.Value = 'rms';

            % Create AverageDropDownLabel
            app.AverageDropDownLabel = uilabel(app.FEATUREPLOTPanel);
            app.AverageDropDownLabel.BackgroundColor = [0.251 0.251 0.251];
            app.AverageDropDownLabel.HorizontalAlignment = 'center';
            app.AverageDropDownLabel.FontName = 'Calibri';
            app.AverageDropDownLabel.FontSize = 18;
            app.AverageDropDownLabel.FontColor = [1 1 1];
            app.AverageDropDownLabel.Position = [59 20 64 24];
            app.AverageDropDownLabel.Text = 'Average';

            % Create AverageDropDown
            app.AverageDropDown = uidropdown(app.FEATUREPLOTPanel);
            app.AverageDropDown.Items = {'1', '2', '5', '10', '20', '30'};
            app.AverageDropDown.FontName = 'Calibri';
            app.AverageDropDown.FontSize = 20;
            app.AverageDropDown.FontColor = [1 1 1];
            app.AverageDropDown.BackgroundColor = [0.251 0.251 0.251];
            app.AverageDropDown.Position = [141 17 61 25];
            app.AverageDropDown.Value = '1';

            % Create STRIDEPLOTPanel
            app.STRIDEPLOTPanel = uipanel(app.PlotTab);
            app.STRIDEPLOTPanel.ForegroundColor = [1 1 1];
            app.STRIDEPLOTPanel.BorderType = 'none';
            app.STRIDEPLOTPanel.TitlePosition = 'centertop';
            app.STRIDEPLOTPanel.Title = 'STRIDE PLOT';
            app.STRIDEPLOTPanel.BackgroundColor = [0.251 0.251 0.251];
            app.STRIDEPLOTPanel.FontName = 'Calibri';
            app.STRIDEPLOTPanel.FontSize = 20;
            app.STRIDEPLOTPanel.Position = [26 291 191 120];

            % Create STRIDEPLOTButton
            app.STRIDEPLOTButton = uibutton(app.STRIDEPLOTPanel, 'push');
            app.STRIDEPLOTButton.ButtonPushedFcn = createCallbackFcn(app, @STRIDEPLOTButtonPushed, true);
            app.STRIDEPLOTButton.BackgroundColor = [0.302 0.302 0.302];
            app.STRIDEPLOTButton.FontName = 'Calibri';
            app.STRIDEPLOTButton.FontSize = 18;
            app.STRIDEPLOTButton.FontColor = [1 1 1];
            app.STRIDEPLOTButton.Position = [98 19 70 50];
            app.STRIDEPLOTButton.Text = 'PLOT';

            % Create meanCheckBox
            app.meanCheckBox = uicheckbox(app.STRIDEPLOTPanel);
            app.meanCheckBox.Text = 'mean';
            app.meanCheckBox.FontName = 'Calibri';
            app.meanCheckBox.FontSize = 18;
            app.meanCheckBox.FontColor = [1 1 1];
            app.meanCheckBox.Position = [18 57 63 24];
            app.meanCheckBox.Value = true;

            % Create stdCheckBox
            app.stdCheckBox = uicheckbox(app.STRIDEPLOTPanel);
            app.stdCheckBox.Text = 'std';
            app.stdCheckBox.FontName = 'Calibri';
            app.stdCheckBox.FontSize = 18;
            app.stdCheckBox.FontColor = [1 1 1];
            app.stdCheckBox.Position = [18 32 63 24];

            % Create eachCheckBox
            app.eachCheckBox = uicheckbox(app.STRIDEPLOTPanel);
            app.eachCheckBox.Text = 'each';
            app.eachCheckBox.FontName = 'Calibri';
            app.eachCheckBox.FontSize = 18;
            app.eachCheckBox.FontColor = [1 1 1];
            app.eachCheckBox.Position = [18 8 63 24];

            % Create STRIDEINTERVALPLOTPanel
            app.STRIDEINTERVALPLOTPanel = uipanel(app.PlotTab);
            app.STRIDEINTERVALPLOTPanel.ForegroundColor = [1 1 1];
            app.STRIDEINTERVALPLOTPanel.BorderType = 'none';
            app.STRIDEINTERVALPLOTPanel.TitlePosition = 'centertop';
            app.STRIDEINTERVALPLOTPanel.Title = 'STRIDE INTERVAL PLOT';
            app.STRIDEINTERVALPLOTPanel.BackgroundColor = [0.2 0.2 0.2];
            app.STRIDEINTERVALPLOTPanel.FontName = 'Calibri';
            app.STRIDEINTERVALPLOTPanel.FontSize = 20;
            app.STRIDEINTERVALPLOTPanel.Position = [231 291 220 120];

            % Create ALTERStridePlotButton_3
            app.ALTERStridePlotButton_3 = uibutton(app.STRIDEINTERVALPLOTPanel, 'push');
            app.ALTERStridePlotButton_3.ButtonPushedFcn = createCallbackFcn(app, @ALTERStridePlotButton_3Pushed, true);
            app.ALTERStridePlotButton_3.BackgroundColor = [0.302 0.302 0.302];
            app.ALTERStridePlotButton_3.FontName = 'Calibri';
            app.ALTERStridePlotButton_3.FontSize = 18;
            app.ALTERStridePlotButton_3.FontColor = [1 1 1];
            app.ALTERStridePlotButton_3.Position = [143 19 70 50];
            app.ALTERStridePlotButton_3.Text = 'PLOT';

            % Create IntervalStepsDropDownLabel
            app.IntervalStepsDropDownLabel = uilabel(app.STRIDEINTERVALPLOTPanel);
            app.IntervalStepsDropDownLabel.BackgroundColor = [0.2 0.2 0.2];
            app.IntervalStepsDropDownLabel.HorizontalAlignment = 'center';
            app.IntervalStepsDropDownLabel.FontName = 'Calibri';
            app.IntervalStepsDropDownLabel.FontSize = 20;
            app.IntervalStepsDropDownLabel.FontColor = [1 1 1];
            app.IntervalStepsDropDownLabel.Position = [16 48 116 26];
            app.IntervalStepsDropDownLabel.Text = 'Interval Steps';

            % Create IntervalStepsDropDown
            app.IntervalStepsDropDown = uidropdown(app.STRIDEINTERVALPLOTPanel);
            app.IntervalStepsDropDown.Items = {'1', '2', '5', '10', '20', '30', '60'};
            app.IntervalStepsDropDown.FontName = 'Calibri';
            app.IntervalStepsDropDown.FontSize = 20;
            app.IntervalStepsDropDown.FontColor = [1 1 1];
            app.IntervalStepsDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.IntervalStepsDropDown.Position = [35 14 79 27];
            app.IntervalStepsDropDown.Value = '1';

            % Create SIGNELSTRIDEPLOTPanel
            app.SIGNELSTRIDEPLOTPanel = uipanel(app.PlotTab);
            app.SIGNELSTRIDEPLOTPanel.ForegroundColor = [1 1 1];
            app.SIGNELSTRIDEPLOTPanel.BorderType = 'none';
            app.SIGNELSTRIDEPLOTPanel.TitlePosition = 'centertop';
            app.SIGNELSTRIDEPLOTPanel.Title = 'SIGNEL STRIDE PLOT';
            app.SIGNELSTRIDEPLOTPanel.BackgroundColor = [0.2 0.2 0.2];
            app.SIGNELSTRIDEPLOTPanel.FontName = 'Calibri';
            app.SIGNELSTRIDEPLOTPanel.FontSize = 20;
            app.SIGNELSTRIDEPLOTPanel.Position = [465 291 296 120];

            % Create ALTERStridePlotButton_5
            app.ALTERStridePlotButton_5 = uibutton(app.SIGNELSTRIDEPLOTPanel, 'push');
            app.ALTERStridePlotButton_5.ButtonPushedFcn = createCallbackFcn(app, @ALTERStridePlotButton_5Pushed, true);
            app.ALTERStridePlotButton_5.BackgroundColor = [0.302 0.302 0.302];
            app.ALTERStridePlotButton_5.FontName = 'Calibri';
            app.ALTERStridePlotButton_5.FontSize = 18;
            app.ALTERStridePlotButton_5.FontColor = [1 1 1];
            app.ALTERStridePlotButton_5.Position = [213 19 70 50];
            app.ALTERStridePlotButton_5.Text = 'PLOT';

            % Create StepsNumDropDownLabel
            app.StepsNumDropDownLabel = uilabel(app.SIGNELSTRIDEPLOTPanel);
            app.StepsNumDropDownLabel.BackgroundColor = [0.2 0.2 0.2];
            app.StepsNumDropDownLabel.HorizontalAlignment = 'center';
            app.StepsNumDropDownLabel.FontName = 'Calibri';
            app.StepsNumDropDownLabel.FontSize = 20;
            app.StepsNumDropDownLabel.FontColor = [1 1 1];
            app.StepsNumDropDownLabel.Position = [36 53 93 26];
            app.StepsNumDropDownLabel.Text = 'Steps Num';

            % Create StepsNumDropDown
            app.StepsNumDropDown = uidropdown(app.SIGNELSTRIDEPLOTPanel);
            app.StepsNumDropDown.Items = {'1', '2', '5', '10', '20', '30', '60'};
            app.StepsNumDropDown.FontName = 'Calibri';
            app.StepsNumDropDown.FontSize = 20;
            app.StepsNumDropDown.FontColor = [1 1 1];
            app.StepsNumDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.StepsNumDropDown.Position = [136 53 71 27];
            app.StepsNumDropDown.Value = '1';

            % Create AverageNumDropDownLabel
            app.AverageNumDropDownLabel = uilabel(app.SIGNELSTRIDEPLOTPanel);
            app.AverageNumDropDownLabel.BackgroundColor = [0.2 0.2 0.2];
            app.AverageNumDropDownLabel.HorizontalAlignment = 'center';
            app.AverageNumDropDownLabel.FontName = 'Calibri';
            app.AverageNumDropDownLabel.FontSize = 20;
            app.AverageNumDropDownLabel.FontColor = [1 1 1];
            app.AverageNumDropDownLabel.Position = [15 15 115 27];
            app.AverageNumDropDownLabel.Text = 'Average Num';

            % Create AverageNumDropDown
            app.AverageNumDropDown = uidropdown(app.SIGNELSTRIDEPLOTPanel);
            app.AverageNumDropDown.Items = {'1', '2', '5', '10', '20', '30'};
            app.AverageNumDropDown.FontName = 'Calibri';
            app.AverageNumDropDown.FontSize = 20;
            app.AverageNumDropDown.FontColor = [1 1 1];
            app.AverageNumDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.AverageNumDropDown.Position = [136 14 71 27];
            app.AverageNumDropDown.Value = '1';

            % Create UpdateButton
            app.UpdateButton = uibutton(app.SIGNELSTRIDEPLOTPanel, 'push');
            app.UpdateButton.ButtonPushedFcn = createCallbackFcn(app, @UpdateButtonPushed, true);
            app.UpdateButton.Icon = '1_refresh.png';
            app.UpdateButton.IconAlignment = 'center';
            app.UpdateButton.BackgroundColor = [0.302 0.302 0.302];
            app.UpdateButton.FontName = 'Calibri';
            app.UpdateButton.FontSize = 18;
            app.UpdateButton.FontColor = [1 1 1];
            app.UpdateButton.Tooltip = {'Update Steps'};
            app.UpdateButton.Position = [8 52 25 25];
            app.UpdateButton.Text = '';

            % Create TrajectoryPLOTPanel
            app.TrajectoryPLOTPanel = uipanel(app.PlotTab);
            app.TrajectoryPLOTPanel.ForegroundColor = [1 1 1];
            app.TrajectoryPLOTPanel.BorderType = 'none';
            app.TrajectoryPLOTPanel.TitlePosition = 'centertop';
            app.TrajectoryPLOTPanel.Title = 'Trajectory PLOT';
            app.TrajectoryPLOTPanel.BackgroundColor = [0.2 0.2 0.2];
            app.TrajectoryPLOTPanel.FontName = 'Calibri';
            app.TrajectoryPLOTPanel.FontSize = 20;
            app.TrajectoryPLOTPanel.Position = [26 144 735 120];

            % Create ALTERStridePlotButton_4
            app.ALTERStridePlotButton_4 = uibutton(app.TrajectoryPLOTPanel, 'push');
            app.ALTERStridePlotButton_4.ButtonPushedFcn = createCallbackFcn(app, @ALTERStridePlotButton_4Pushed, true);
            app.ALTERStridePlotButton_4.BackgroundColor = [0.302 0.302 0.302];
            app.ALTERStridePlotButton_4.FontName = 'Calibri';
            app.ALTERStridePlotButton_4.FontSize = 18;
            app.ALTERStridePlotButton_4.FontColor = [1 1 1];
            app.ALTERStridePlotButton_4.Position = [650 20 70 50];
            app.ALTERStridePlotButton_4.Text = 'PLOT';

            % Create StepsDropDownLabel
            app.StepsDropDownLabel = uilabel(app.TrajectoryPLOTPanel);
            app.StepsDropDownLabel.BackgroundColor = [0.2 0.2 0.2];
            app.StepsDropDownLabel.HorizontalAlignment = 'center';
            app.StepsDropDownLabel.FontName = 'Calibri';
            app.StepsDropDownLabel.FontSize = 20;
            app.StepsDropDownLabel.FontColor = [1 1 1];
            app.StepsDropDownLabel.Position = [464 32 49 26];
            app.StepsDropDownLabel.Text = 'Steps';

            % Create StepsDropDown
            app.StepsDropDown = uidropdown(app.TrajectoryPLOTPanel);
            app.StepsDropDown.Items = {'1', '2', '5', '10', '20', '30'};
            app.StepsDropDown.FontName = 'Calibri';
            app.StepsDropDown.FontSize = 20;
            app.StepsDropDown.FontColor = [1 1 1];
            app.StepsDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.StepsDropDown.Position = [527 31 66 27];
            app.StepsDropDown.Value = '1';

            % Create LinecolorDropDownLabel
            app.LinecolorDropDownLabel = uilabel(app.TrajectoryPLOTPanel);
            app.LinecolorDropDownLabel.BackgroundColor = [0.2 0.2 0.2];
            app.LinecolorDropDownLabel.HorizontalAlignment = 'center';
            app.LinecolorDropDownLabel.FontName = 'Calibri';
            app.LinecolorDropDownLabel.FontSize = 20;
            app.LinecolorDropDownLabel.FontColor = [1 1 1];
            app.LinecolorDropDownLabel.Position = [247 32 80 26];
            app.LinecolorDropDownLabel.Text = 'Linecolor';

            % Create LinecolorDropDown
            app.LinecolorDropDown = uidropdown(app.TrajectoryPLOTPanel);
            app.LinecolorDropDown.Items = {'Fixed', 'Changed'};
            app.LinecolorDropDown.FontName = 'Calibri';
            app.LinecolorDropDown.FontSize = 20;
            app.LinecolorDropDown.FontColor = [1 1 1];
            app.LinecolorDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.LinecolorDropDown.Position = [341 31 94 27];
            app.LinecolorDropDown.Value = 'Fixed';

            % Create PlotTypeDropDownLabel
            app.PlotTypeDropDownLabel = uilabel(app.TrajectoryPLOTPanel);
            app.PlotTypeDropDownLabel.BackgroundColor = [0.2 0.2 0.2];
            app.PlotTypeDropDownLabel.HorizontalAlignment = 'center';
            app.PlotTypeDropDownLabel.FontName = 'Calibri';
            app.PlotTypeDropDownLabel.FontSize = 20;
            app.PlotTypeDropDownLabel.FontColor = [1 1 1];
            app.PlotTypeDropDownLabel.Position = [31 32 81 26];
            app.PlotTypeDropDownLabel.Text = 'Plot Type';

            % Create PlotTypeDropDown
            app.PlotTypeDropDown = uidropdown(app.TrajectoryPLOTPanel);
            app.PlotTypeDropDown.Items = {'PeakTime', 'PeakTorque', 'BOTH'};
            app.PlotTypeDropDown.FontName = 'Calibri';
            app.PlotTypeDropDown.FontSize = 20;
            app.PlotTypeDropDown.FontColor = [1 1 1];
            app.PlotTypeDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.PlotTypeDropDown.Position = [126 31 94 27];
            app.PlotTypeDropDown.Value = 'BOTH';

            % Create BarTab
            app.BarTab = uitab(app.PlotGroup);
            app.BarTab.Title = 'BarTab';
            app.BarTab.BackgroundColor = [0.149 0.149 0.149];

            % Create FEATURESBARPLOTPanel
            app.FEATURESBARPLOTPanel = uipanel(app.BarTab);
            app.FEATURESBARPLOTPanel.ForegroundColor = [1 1 1];
            app.FEATURESBARPLOTPanel.BorderType = 'none';
            app.FEATURESBARPLOTPanel.TitlePosition = 'centertop';
            app.FEATURESBARPLOTPanel.Title = 'FEATURES BAR PLOT';
            app.FEATURESBARPLOTPanel.BackgroundColor = [0.2 0.2 0.2];
            app.FEATURESBARPLOTPanel.FontName = 'Calibri';
            app.FEATURESBARPLOTPanel.FontSize = 20;
            app.FEATURESBARPLOTPanel.Position = [19 122 753 427];

            % Create ClassListBox
            app.ClassListBox = uilistbox(app.FEATURESBARPLOTPanel);
            app.ClassListBox.Items = {};
            app.ClassListBox.FontName = 'Calibri';
            app.ClassListBox.FontSize = 18;
            app.ClassListBox.FontColor = [1 1 1];
            app.ClassListBox.BackgroundColor = [0.502 0.502 0.502];
            app.ClassListBox.Position = [19 209 332 153];
            app.ClassListBox.Value = {};

            % Create GroupListBox
            app.GroupListBox = uilistbox(app.FEATURESBARPLOTPanel);
            app.GroupListBox.Items = {};
            app.GroupListBox.FontName = 'Calibri';
            app.GroupListBox.FontSize = 18;
            app.GroupListBox.FontColor = [1 1 1];
            app.GroupListBox.BackgroundColor = [0.502 0.502 0.502];
            app.GroupListBox.Position = [396 209 333 153];
            app.GroupListBox.Value = {};

            % Create ClassLabel
            app.ClassLabel = uilabel(app.FEATURESBARPLOTPanel);
            app.ClassLabel.VerticalAlignment = 'top';
            app.ClassLabel.FontName = 'Calibri';
            app.ClassLabel.FontSize = 26;
            app.ClassLabel.FontColor = [1 1 1];
            app.ClassLabel.Position = [19 363 58 35];
            app.ClassLabel.Text = 'Class';

            % Create GroupLabel
            app.GroupLabel = uilabel(app.FEATURESBARPLOTPanel);
            app.GroupLabel.VerticalAlignment = 'top';
            app.GroupLabel.FontName = 'Calibri';
            app.GroupLabel.FontSize = 26;
            app.GroupLabel.FontColor = [1 1 1];
            app.GroupLabel.Position = [396 361 72 35];
            app.GroupLabel.Text = 'Group';

            % Create Panel_14
            app.Panel_14 = uipanel(app.FEATURESBARPLOTPanel);
            app.Panel_14.BorderType = 'none';
            app.Panel_14.BackgroundColor = [0.302 0.302 0.302];
            app.Panel_14.Position = [367 140 10 232];

            % Create ClassAddButton_3
            app.ClassAddButton_3 = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.ClassAddButton_3.ButtonPushedFcn = createCallbackFcn(app, @ClassAddButtonPushed, true);
            app.ClassAddButton_3.Icon = 'add (1).png';
            app.ClassAddButton_3.IconAlignment = 'center';
            app.ClassAddButton_3.BackgroundColor = [0.302 0.302 0.302];
            app.ClassAddButton_3.FontName = 'Calibri';
            app.ClassAddButton_3.FontSize = 18;
            app.ClassAddButton_3.FontColor = [1 1 1];
            app.ClassAddButton_3.Position = [24 146 40 40];
            app.ClassAddButton_3.Text = '';

            % Create ClassClearButton_3
            app.ClassClearButton_3 = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.ClassClearButton_3.ButtonPushedFcn = createCallbackFcn(app, @ClassClearButtonPushed, true);
            app.ClassClearButton_3.Icon = 'clear.png';
            app.ClassClearButton_3.IconAlignment = 'center';
            app.ClassClearButton_3.BackgroundColor = [0.302 0.302 0.302];
            app.ClassClearButton_3.FontName = 'Calibri';
            app.ClassClearButton_3.FontSize = 18;
            app.ClassClearButton_3.FontColor = [1 1 1];
            app.ClassClearButton_3.Position = [138 146 40 40];
            app.ClassClearButton_3.Text = '';

            % Create ClassDeleteButton_3
            app.ClassDeleteButton_3 = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.ClassDeleteButton_3.ButtonPushedFcn = createCallbackFcn(app, @ClassDeleteButtonPushed, true);
            app.ClassDeleteButton_3.Icon = 'minus-square.png';
            app.ClassDeleteButton_3.BackgroundColor = [0.302 0.302 0.302];
            app.ClassDeleteButton_3.FontName = 'Calibri';
            app.ClassDeleteButton_3.FontSize = 18;
            app.ClassDeleteButton_3.FontColor = [1 1 1];
            app.ClassDeleteButton_3.Position = [81 146 40 40];
            app.ClassDeleteButton_3.Text = '';

            % Create ClassUpButton_3
            app.ClassUpButton_3 = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.ClassUpButton_3.ButtonPushedFcn = createCallbackFcn(app, @ClassUpButtonPushed, true);
            app.ClassUpButton_3.Icon = 'caret-up.png';
            app.ClassUpButton_3.IconAlignment = 'center';
            app.ClassUpButton_3.BackgroundColor = [0.302 0.302 0.302];
            app.ClassUpButton_3.FontName = 'Calibri';
            app.ClassUpButton_3.FontSize = 18;
            app.ClassUpButton_3.FontColor = [1 1 1];
            app.ClassUpButton_3.Position = [195 146 40 40];
            app.ClassUpButton_3.Text = '';

            % Create ClassRenameButton
            app.ClassRenameButton = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.ClassRenameButton.ButtonPushedFcn = createCallbackFcn(app, @ClassRenameButtonPushed, true);
            app.ClassRenameButton.Icon = 'edit-fill.png';
            app.ClassRenameButton.IconAlignment = 'center';
            app.ClassRenameButton.BackgroundColor = [0.302 0.302 0.302];
            app.ClassRenameButton.FontName = 'Calibri';
            app.ClassRenameButton.FontSize = 18;
            app.ClassRenameButton.FontColor = [1 1 1];
            app.ClassRenameButton.Position = [307 146 40 40];
            app.ClassRenameButton.Text = '';

            % Create ClassDownButton_3
            app.ClassDownButton_3 = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.ClassDownButton_3.ButtonPushedFcn = createCallbackFcn(app, @ClassDownButtonPushed, true);
            app.ClassDownButton_3.Icon = 'caret-down.png';
            app.ClassDownButton_3.IconAlignment = 'center';
            app.ClassDownButton_3.BackgroundColor = [0.302 0.302 0.302];
            app.ClassDownButton_3.FontName = 'Calibri';
            app.ClassDownButton_3.FontSize = 18;
            app.ClassDownButton_3.FontColor = [1 1 1];
            app.ClassDownButton_3.Position = [251 146 40 40];
            app.ClassDownButton_3.Text = '';

            % Create GroupAddButton
            app.GroupAddButton = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.GroupAddButton.ButtonPushedFcn = createCallbackFcn(app, @GroupAddButtonPushed, true);
            app.GroupAddButton.Icon = 'add (1).png';
            app.GroupAddButton.IconAlignment = 'center';
            app.GroupAddButton.BackgroundColor = [0.302 0.302 0.302];
            app.GroupAddButton.FontName = 'Calibri';
            app.GroupAddButton.FontSize = 18;
            app.GroupAddButton.FontColor = [1 1 1];
            app.GroupAddButton.Position = [401 146 40 40];
            app.GroupAddButton.Text = '';

            % Create GroupClearButton
            app.GroupClearButton = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.GroupClearButton.ButtonPushedFcn = createCallbackFcn(app, @GroupClearButtonPushed, true);
            app.GroupClearButton.Icon = 'clear.png';
            app.GroupClearButton.IconAlignment = 'center';
            app.GroupClearButton.BackgroundColor = [0.302 0.302 0.302];
            app.GroupClearButton.FontName = 'Calibri';
            app.GroupClearButton.FontSize = 18;
            app.GroupClearButton.FontColor = [1 1 1];
            app.GroupClearButton.Position = [515 146 40 40];
            app.GroupClearButton.Text = '';

            % Create GroupDeleteButton
            app.GroupDeleteButton = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.GroupDeleteButton.ButtonPushedFcn = createCallbackFcn(app, @GroupDeleteButtonPushed, true);
            app.GroupDeleteButton.Icon = 'minus-square.png';
            app.GroupDeleteButton.IconAlignment = 'center';
            app.GroupDeleteButton.BackgroundColor = [0.302 0.302 0.302];
            app.GroupDeleteButton.FontName = 'Calibri';
            app.GroupDeleteButton.FontSize = 18;
            app.GroupDeleteButton.FontColor = [1 1 1];
            app.GroupDeleteButton.Position = [458 146 40 40];
            app.GroupDeleteButton.Text = '';

            % Create GroupUpButton
            app.GroupUpButton = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.GroupUpButton.ButtonPushedFcn = createCallbackFcn(app, @GroupUpButtonPushed, true);
            app.GroupUpButton.Icon = 'caret-up.png';
            app.GroupUpButton.BackgroundColor = [0.302 0.302 0.302];
            app.GroupUpButton.FontName = 'Calibri';
            app.GroupUpButton.FontSize = 18;
            app.GroupUpButton.FontColor = [1 1 1];
            app.GroupUpButton.Position = [572 146 40 40];
            app.GroupUpButton.Text = '';

            % Create GroupRenameButton
            app.GroupRenameButton = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.GroupRenameButton.ButtonPushedFcn = createCallbackFcn(app, @GroupRenameButtonPushed, true);
            app.GroupRenameButton.Icon = 'edit-fill.png';
            app.GroupRenameButton.IconAlignment = 'center';
            app.GroupRenameButton.BackgroundColor = [0.302 0.302 0.302];
            app.GroupRenameButton.FontName = 'Calibri';
            app.GroupRenameButton.FontSize = 18;
            app.GroupRenameButton.FontColor = [1 1 1];
            app.GroupRenameButton.Position = [684 146 40 40];
            app.GroupRenameButton.Text = '';

            % Create GroupDownButton
            app.GroupDownButton = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.GroupDownButton.ButtonPushedFcn = createCallbackFcn(app, @GroupDownButtonPushed, true);
            app.GroupDownButton.Icon = 'caret-down.png';
            app.GroupDownButton.IconAlignment = 'center';
            app.GroupDownButton.BackgroundColor = [0.302 0.302 0.302];
            app.GroupDownButton.FontName = 'Calibri';
            app.GroupDownButton.FontSize = 18;
            app.GroupDownButton.FontColor = [1 1 1];
            app.GroupDownButton.Position = [628 146 40 40];
            app.GroupDownButton.Text = '';

            % Create VarAlterPlotButton
            app.VarAlterPlotButton = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.VarAlterPlotButton.ButtonPushedFcn = createCallbackFcn(app, @VarAlterPlotButton_3Pushed, true);
            app.VarAlterPlotButton.BackgroundColor = [0.302 0.302 0.302];
            app.VarAlterPlotButton.FontName = 'Calibri';
            app.VarAlterPlotButton.FontSize = 18;
            app.VarAlterPlotButton.FontColor = [1 1 1];
            app.VarAlterPlotButton.Position = [217 88 130 36];
            app.VarAlterPlotButton.Text = 'GROUP BAR';

            % Create CHANGECOLORButton
            app.CHANGECOLORButton = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.CHANGECOLORButton.ButtonPushedFcn = createCallbackFcn(app, @CHANGECOLORButton_2Pushed, true);
            app.CHANGECOLORButton.Icon = 'color_Change.png';
            app.CHANGECOLORButton.BackgroundColor = [0.302 0.302 0.302];
            app.CHANGECOLORButton.FontName = 'Calibri';
            app.CHANGECOLORButton.FontSize = 18;
            app.CHANGECOLORButton.FontColor = [1 1 1];
            app.CHANGECOLORButton.Position = [559 50 47 64];
            app.CHANGECOLORButton.Text = '';

            % Create FeatureDropDown_2Label_5
            app.FeatureDropDown_2Label_5 = uilabel(app.FEATURESBARPLOTPanel);
            app.FeatureDropDown_2Label_5.HorizontalAlignment = 'center';
            app.FeatureDropDown_2Label_5.FontName = 'Calibri';
            app.FeatureDropDown_2Label_5.FontSize = 18;
            app.FeatureDropDown_2Label_5.FontColor = [1 1 1];
            app.FeatureDropDown_2Label_5.Position = [29 92 61 24];
            app.FeatureDropDown_2Label_5.Text = 'Feature';

            % Create BarFeatureDropDown
            app.BarFeatureDropDown = uidropdown(app.FEATURESBARPLOTPanel);
            app.BarFeatureDropDown.Items = {'rms', 'mean', 'max', 'min', 'pt', 'meanP', 'maxP', 'pos_mean', 'neg_mean'};
            app.BarFeatureDropDown.FontName = 'Calibri';
            app.BarFeatureDropDown.FontSize = 18;
            app.BarFeatureDropDown.FontColor = [1 1 1];
            app.BarFeatureDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.BarFeatureDropDown.Position = [100 91 85 25];
            app.BarFeatureDropDown.Value = 'rms';

            % Create GroupIndexDropDownLabel
            app.GroupIndexDropDownLabel = uilabel(app.FEATURESBARPLOTPanel);
            app.GroupIndexDropDownLabel.BackgroundColor = [0.2 0.2 0.2];
            app.GroupIndexDropDownLabel.HorizontalAlignment = 'center';
            app.GroupIndexDropDownLabel.FontName = 'Calibri';
            app.GroupIndexDropDownLabel.FontSize = 20;
            app.GroupIndexDropDownLabel.FontColor = [1 1 1];
            app.GroupIndexDropDownLabel.Position = [399 88 105 27];
            app.GroupIndexDropDownLabel.Text = 'Group Index';

            % Create GroupIndexDropDown
            app.GroupIndexDropDown = uidropdown(app.FEATURESBARPLOTPanel);
            app.GroupIndexDropDown.Items = {};
            app.GroupIndexDropDown.FontName = 'Calibri';
            app.GroupIndexDropDown.FontSize = 16;
            app.GroupIndexDropDown.FontColor = [1 1 1];
            app.GroupIndexDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.GroupIndexDropDown.Position = [363 49.5 178 26.5];
            app.GroupIndexDropDown.Value = {};

            % Create TypeDropDownLabel
            app.TypeDropDownLabel = uilabel(app.FEATURESBARPLOTPanel);
            app.TypeDropDownLabel.HorizontalAlignment = 'center';
            app.TypeDropDownLabel.FontName = 'Calibri';
            app.TypeDropDownLabel.FontSize = 18;
            app.TypeDropDownLabel.FontColor = [1 1 1];
            app.TypeDropDownLabel.Position = [32 53 40 24];
            app.TypeDropDownLabel.Text = 'Type';

            % Create BarTypeDropDown
            app.BarTypeDropDown = uidropdown(app.FEATURESBARPLOTPanel);
            app.BarTypeDropDown.Items = {'bar', 'error-bar'};
            app.BarTypeDropDown.FontName = 'Calibri';
            app.BarTypeDropDown.FontSize = 18;
            app.BarTypeDropDown.FontColor = [1 1 1];
            app.BarTypeDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.BarTypeDropDown.Position = [85 52 103 25];
            app.BarTypeDropDown.Value = 'bar';

            % Create ALTERNEWButton_9
            app.ALTERNEWButton_9 = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.ALTERNEWButton_9.ButtonPushedFcn = createCallbackFcn(app, @ALTERNEWButton_7Pushed, true);
            app.ALTERNEWButton_9.BackgroundColor = [0.302 0.302 0.302];
            app.ALTERNEWButton_9.FontName = 'Calibri';
            app.ALTERNEWButton_9.FontSize = 18;
            app.ALTERNEWButton_9.FontColor = [1 1 1];
            app.ALTERNEWButton_9.Position = [628 49 96 65];
            app.ALTERNEWButton_9.Text = {'Export'; 'Data'};

            % Create GROUPPLOTButton
            app.GROUPPLOTButton = uibutton(app.FEATURESBARPLOTPanel, 'push');
            app.GROUPPLOTButton.ButtonPushedFcn = createCallbackFcn(app, @VarAlterPlotButton_4Pushed, true);
            app.GROUPPLOTButton.BackgroundColor = [0.302 0.302 0.302];
            app.GROUPPLOTButton.FontName = 'Calibri';
            app.GROUPPLOTButton.FontSize = 18;
            app.GROUPPLOTButton.FontColor = [1 1 1];
            app.GROUPPLOTButton.Position = [217 41 130 36];
            app.GROUPPLOTButton.Text = 'GROUP PLOT';

            % Create FitTab
            app.FitTab = uitab(app.PlotGroup);
            app.FitTab.Title = 'FitTab';
            app.FitTab.BackgroundColor = [0.149 0.149 0.149];

            % Create FITTINGANALYSISPanel
            app.FITTINGANALYSISPanel = uipanel(app.FitTab);
            app.FITTINGANALYSISPanel.ForegroundColor = [1 1 1];
            app.FITTINGANALYSISPanel.BorderType = 'none';
            app.FITTINGANALYSISPanel.TitlePosition = 'centertop';
            app.FITTINGANALYSISPanel.Title = 'FITTING ANALYSIS';
            app.FITTINGANALYSISPanel.BackgroundColor = [0.2 0.2 0.2];
            app.FITTINGANALYSISPanel.FontName = 'Calibri';
            app.FITTINGANALYSISPanel.FontSize = 20;
            app.FITTINGANALYSISPanel.Position = [18 53 753 504];

            % Create ClassAddButton_4
            app.ClassAddButton_4 = uibutton(app.FITTINGANALYSISPanel, 'push');
            app.ClassAddButton_4.ButtonPushedFcn = createCallbackFcn(app, @ClassAddButton_2Pushed, true);
            app.ClassAddButton_4.Icon = 'Right Arrow.png';
            app.ClassAddButton_4.IconAlignment = 'center';
            app.ClassAddButton_4.BackgroundColor = [0.302 0.302 0.302];
            app.ClassAddButton_4.FontName = 'Calibri';
            app.ClassAddButton_4.FontSize = 18;
            app.ClassAddButton_4.FontColor = [1 1 1];
            app.ClassAddButton_4.Position = [18 350 71 35];
            app.ClassAddButton_4.Text = '';

            % Create ClassClearButton_4
            app.ClassClearButton_4 = uibutton(app.FITTINGANALYSISPanel, 'push');
            app.ClassClearButton_4.ButtonPushedFcn = createCallbackFcn(app, @ClassClearButton_2Pushed, true);
            app.ClassClearButton_4.Icon = 'clear.png';
            app.ClassClearButton_4.IconAlignment = 'center';
            app.ClassClearButton_4.BackgroundColor = [0.302 0.302 0.302];
            app.ClassClearButton_4.FontName = 'Calibri';
            app.ClassClearButton_4.FontSize = 18;
            app.ClassClearButton_4.FontColor = [1 1 1];
            app.ClassClearButton_4.Position = [18 254 71 35];
            app.ClassClearButton_4.Text = '';

            % Create ClassDeleteButton_4
            app.ClassDeleteButton_4 = uibutton(app.FITTINGANALYSISPanel, 'push');
            app.ClassDeleteButton_4.ButtonPushedFcn = createCallbackFcn(app, @ClassDeleteButton_2Pushed, true);
            app.ClassDeleteButton_4.Icon = '错.png';
            app.ClassDeleteButton_4.BackgroundColor = [0.302 0.302 0.302];
            app.ClassDeleteButton_4.FontName = 'Calibri';
            app.ClassDeleteButton_4.FontSize = 18;
            app.ClassDeleteButton_4.FontColor = [1 1 1];
            app.ClassDeleteButton_4.Position = [18 302 71 35];
            app.ClassDeleteButton_4.Text = '';

            % Create FeatureDropDown_2Label_6
            app.FeatureDropDown_2Label_6 = uilabel(app.FITTINGANALYSISPanel);
            app.FeatureDropDown_2Label_6.HorizontalAlignment = 'center';
            app.FeatureDropDown_2Label_6.FontName = 'Calibri';
            app.FeatureDropDown_2Label_6.FontSize = 18;
            app.FeatureDropDown_2Label_6.FontColor = [1 1 1];
            app.FeatureDropDown_2Label_6.Position = [21 426 61 24];
            app.FeatureDropDown_2Label_6.Text = 'Feature';

            % Create FitFeatureDropDown
            app.FitFeatureDropDown = uidropdown(app.FITTINGANALYSISPanel);
            app.FitFeatureDropDown.Items = {'rms', 'mean', 'max', 'min', 'pt', 'meanP', 'maxP', 'pos_mean', 'neg_mean'};
            app.FitFeatureDropDown.FontName = 'Calibri';
            app.FitFeatureDropDown.FontSize = 18;
            app.FitFeatureDropDown.FontColor = [1 1 1];
            app.FitFeatureDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.FitFeatureDropDown.Position = [18 398 71 25];
            app.FitFeatureDropDown.Value = 'rms';

            % Create ALTERNEWButton_10
            app.ALTERNEWButton_10 = uibutton(app.FITTINGANALYSISPanel, 'push');
            app.ALTERNEWButton_10.ButtonPushedFcn = createCallbackFcn(app, @ALTERNEWButton_8Pushed, true);
            app.ALTERNEWButton_10.BackgroundColor = [0.302 0.302 0.302];
            app.ALTERNEWButton_10.FontName = 'Calibri';
            app.ALTERNEWButton_10.FontSize = 18;
            app.ALTERNEWButton_10.FontColor = [1 1 1];
            app.ALTERNEWButton_10.Position = [383 39 96 83];
            app.ALTERNEWButton_10.Text = {'Export'; 'Data'};

            % Create FittingTable
            app.FittingTable = uitable(app.FITTINGANALYSISPanel);
            app.FittingTable.ColumnName = {'Name'; 'Value'; 'LabelX'; 'LabelY'};
            app.FittingTable.ColumnWidth = {250, 'auto', 'auto', 'auto'};
            app.FittingTable.RowName = {};
            app.FittingTable.ColumnEditable = [false false true true];
            app.FittingTable.RowStriping = 'off';
            app.FittingTable.CellSelectionCallback = createCallbackFcn(app, @FittingTableCellSelection, true);
            app.FittingTable.ForegroundColor = [0.2 0.2 0.2];
            app.FittingTable.FontName = 'Calibri';
            app.FittingTable.FontSize = 16;
            app.FittingTable.Position = [110 160 625 290];

            % Create AddLabelXButton
            app.AddLabelXButton = uibutton(app.FITTINGANALYSISPanel, 'push');
            app.AddLabelXButton.IconAlignment = 'center';
            app.AddLabelXButton.BackgroundColor = [0.302 0.302 0.302];
            app.AddLabelXButton.FontName = 'Calibri';
            app.AddLabelXButton.FontSize = 14;
            app.AddLabelXButton.FontColor = [1 1 1];
            app.AddLabelXButton.Position = [18 207 71 35];
            app.AddLabelXButton.Text = 'Add LabelX';

            % Create AddLabelYButton
            app.AddLabelYButton = uibutton(app.FITTINGANALYSISPanel, 'push');
            app.AddLabelYButton.IconAlignment = 'center';
            app.AddLabelYButton.BackgroundColor = [0.302 0.302 0.302];
            app.AddLabelYButton.FontName = 'Calibri';
            app.AddLabelYButton.FontSize = 14;
            app.AddLabelYButton.FontColor = [1 1 1];
            app.AddLabelYButton.Position = [18 160 71 35];
            app.AddLabelYButton.Text = {'Add LabelY'; ''};

            % Create FittingButton1
            app.FittingButton1 = uibutton(app.FITTINGANALYSISPanel, 'push');
            app.FittingButton1.ButtonPushedFcn = createCallbackFcn(app, @FittingButton1Pushed2, true);
            app.FittingButton1.IconAlignment = 'center';
            app.FittingButton1.BackgroundColor = [0.302 0.302 0.302];
            app.FittingButton1.FontName = 'Calibri';
            app.FittingButton1.FontSize = 18;
            app.FittingButton1.FontColor = [1 1 1];
            app.FittingButton1.Position = [18 90 151 32];
            app.FittingButton1.Text = '1-D Fit & Interp';

            % Create FittingMethodDropDown1
            app.FittingMethodDropDown1 = uidropdown(app.FITTINGANALYSISPanel);
            app.FittingMethodDropDown1.Items = {'linearinterp', 'cubicinterp', 'smoothingspline', 'poly1', 'poly2', 'poly3', 'sin1', 'sin2', 'sin3', 'power1', 'power2', 'exp1', 'exp2', 'gauss1', 'gauss2', 'gauss3', 'fourier1', 'fourier2', 'fourier3', 'weibull', 'cubicspline', 'smoothingspline'};
            app.FittingMethodDropDown1.FontName = 'Calibri';
            app.FittingMethodDropDown1.FontSize = 16;
            app.FittingMethodDropDown1.FontColor = [1 1 1];
            app.FittingMethodDropDown1.BackgroundColor = [0.2 0.2 0.2];
            app.FittingMethodDropDown1.Position = [183 90 158 32];
            app.FittingMethodDropDown1.Value = 'poly1';

            % Create FittingMethodDropDown2
            app.FittingMethodDropDown2 = uidropdown(app.FITTINGANALYSISPanel);
            app.FittingMethodDropDown2.Items = {'linearinterp', 'cubicinterp', 'biharmonicinterp', 'thinplateinterp', 'nearestinterp', 'poly11', 'poly21', 'poly12', 'poly22', 'poly23', 'poly32', 'lowess', 'loess'};
            app.FittingMethodDropDown2.FontName = 'Calibri';
            app.FittingMethodDropDown2.FontSize = 16;
            app.FittingMethodDropDown2.FontColor = [1 1 1];
            app.FittingMethodDropDown2.BackgroundColor = [0.2 0.2 0.2];
            app.FittingMethodDropDown2.Position = [183 39 158 32];
            app.FittingMethodDropDown2.Value = 'biharmonicinterp';

            % Create FittingButton2
            app.FittingButton2 = uibutton(app.FITTINGANALYSISPanel, 'push');
            app.FittingButton2.ButtonPushedFcn = createCallbackFcn(app, @FittingButton2Pushed, true);
            app.FittingButton2.IconAlignment = 'center';
            app.FittingButton2.BackgroundColor = [0.302 0.302 0.302];
            app.FittingButton2.FontName = 'Calibri';
            app.FittingButton2.FontSize = 18;
            app.FittingButton2.FontColor = [1 1 1];
            app.FittingButton2.Position = [18 39 151 32];
            app.FittingButton2.Text = {'2-D  Fit & Interp'; ''};

            % Create SignifTab
            app.SignifTab = uitab(app.PlotGroup);
            app.SignifTab.Title = 'SignifTab';
            app.SignifTab.BackgroundColor = [0.149 0.149 0.149];

            % Create SIGNIFICANCEANALYSISPanel
            app.SIGNIFICANCEANALYSISPanel = uipanel(app.SignifTab);
            app.SIGNIFICANCEANALYSISPanel.ForegroundColor = [1 1 1];
            app.SIGNIFICANCEANALYSISPanel.BorderType = 'none';
            app.SIGNIFICANCEANALYSISPanel.TitlePosition = 'centertop';
            app.SIGNIFICANCEANALYSISPanel.Title = 'SIGNIFICANCE ANALYSIS';
            app.SIGNIFICANCEANALYSISPanel.BackgroundColor = [0.2 0.2 0.2];
            app.SIGNIFICANCEANALYSISPanel.FontName = 'Calibri';
            app.SIGNIFICANCEANALYSISPanel.FontSize = 20;
            app.SIGNIFICANCEANALYSISPanel.Position = [18 52 753 504];

            % Create AddGroupButton
            app.AddGroupButton = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.AddGroupButton.ButtonPushedFcn = createCallbackFcn(app, @AddGroupButtonPushed, true);
            app.AddGroupButton.Icon = 'add (1).png';
            app.AddGroupButton.IconAlignment = 'center';
            app.AddGroupButton.BackgroundColor = [0.302 0.302 0.302];
            app.AddGroupButton.FontName = 'Calibri';
            app.AddGroupButton.FontSize = 18;
            app.AddGroupButton.FontColor = [1 1 1];
            app.AddGroupButton.Position = [26 369 71 35];
            app.AddGroupButton.Text = '';

            % Create ClearGroupButton
            app.ClearGroupButton = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.ClearGroupButton.ButtonPushedFcn = createCallbackFcn(app, @ClearGroupButtonPushed, true);
            app.ClearGroupButton.Icon = 'clear.png';
            app.ClearGroupButton.IconAlignment = 'center';
            app.ClearGroupButton.BackgroundColor = [0.302 0.302 0.302];
            app.ClearGroupButton.FontName = 'Calibri';
            app.ClearGroupButton.FontSize = 18;
            app.ClearGroupButton.FontColor = [1 1 1];
            app.ClearGroupButton.Position = [26 265 71 35];
            app.ClearGroupButton.Text = '';

            % Create DeleteGroupButton
            app.DeleteGroupButton = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.DeleteGroupButton.ButtonPushedFcn = createCallbackFcn(app, @DeleteGroupButtonPushed, true);
            app.DeleteGroupButton.Icon = '错.png';
            app.DeleteGroupButton.BackgroundColor = [0.302 0.302 0.302];
            app.DeleteGroupButton.FontName = 'Calibri';
            app.DeleteGroupButton.FontSize = 18;
            app.DeleteGroupButton.FontColor = [1 1 1];
            app.DeleteGroupButton.Position = [26 317 71 35];
            app.DeleteGroupButton.Text = '';

            % Create SigTable
            app.SigTable = uitable(app.SIGNIFICANCEANALYSISPanel);
            app.SigTable.ColumnName = {'Group'; 'P-Value'};
            app.SigTable.ColumnWidth = {'auto', 100};
            app.SigTable.RowName = {};
            app.SigTable.RowStriping = 'off';
            app.SigTable.CellSelectionCallback = createCallbackFcn(app, @SigTableCellSelection, true);
            app.SigTable.ForegroundColor = [0.2 0.2 0.2];
            app.SigTable.FontName = 'Calibri';
            app.SigTable.FontSize = 16;
            app.SigTable.Position = [119 162 294 287];

            % Create AddDataButton1
            app.AddDataButton1 = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.AddDataButton1.ButtonPushedFcn = createCallbackFcn(app, @AddDataButton1Pushed, true);
            app.AddDataButton1.IconAlignment = 'center';
            app.AddDataButton1.BackgroundColor = [0.302 0.302 0.302];
            app.AddDataButton1.FontName = 'Calibri';
            app.AddDataButton1.FontSize = 18;
            app.AddDataButton1.FontColor = [1 1 1];
            app.AddDataButton1.Position = [559 369 167 39];
            app.AddDataButton1.Text = 'Add Average Data';

            % Create AddDataButton2
            app.AddDataButton2 = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.AddDataButton2.ButtonPushedFcn = createCallbackFcn(app, @AddDataButton2Pushed, true);
            app.AddDataButton2.IconAlignment = 'center';
            app.AddDataButton2.BackgroundColor = [0.302 0.302 0.302];
            app.AddDataButton2.FontName = 'Calibri';
            app.AddDataButton2.FontSize = 18;
            app.AddDataButton2.FontColor = [1 1 1];
            app.AddDataButton2.Position = [559 317 167 39];
            app.AddDataButton2.Text = 'Add Step Data';

            % Create ClassUpButton_4
            app.ClassUpButton_4 = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.ClassUpButton_4.ButtonPushedFcn = createCallbackFcn(app, @ClassUpButton_2Pushed, true);
            app.ClassUpButton_4.Icon = 'caret-up.png';
            app.ClassUpButton_4.IconAlignment = 'center';
            app.ClassUpButton_4.BackgroundColor = [0.302 0.302 0.302];
            app.ClassUpButton_4.FontName = 'Calibri';
            app.ClassUpButton_4.FontSize = 18;
            app.ClassUpButton_4.FontColor = [1 1 1];
            app.ClassUpButton_4.Position = [26 213 71 35];
            app.ClassUpButton_4.Text = '';

            % Create ClassDownButton_4
            app.ClassDownButton_4 = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.ClassDownButton_4.Icon = 'caret-down.png';
            app.ClassDownButton_4.IconAlignment = 'center';
            app.ClassDownButton_4.BackgroundColor = [0.302 0.302 0.302];
            app.ClassDownButton_4.FontName = 'Calibri';
            app.ClassDownButton_4.FontSize = 18;
            app.ClassDownButton_4.FontColor = [1 1 1];
            app.ClassDownButton_4.Position = [26 162 71 35];
            app.ClassDownButton_4.Text = '';

            % Create GroupDataListBox
            app.GroupDataListBox = uilistbox(app.SIGNIFICANCEANALYSISPanel);
            app.GroupDataListBox.Items = {};
            app.GroupDataListBox.FontName = 'Calibri';
            app.GroupDataListBox.FontSize = 18;
            app.GroupDataListBox.FontColor = [1 1 1];
            app.GroupDataListBox.BackgroundColor = [0.502 0.502 0.502];
            app.GroupDataListBox.Position = [414 162 117 287];
            app.GroupDataListBox.Value = {};

            % Create AddDataButton2_2
            app.AddDataButton2_2 = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.AddDataButton2_2.ButtonPushedFcn = createCallbackFcn(app, @AddDataButton2_2Pushed, true);
            app.AddDataButton2_2.IconAlignment = 'center';
            app.AddDataButton2_2.BackgroundColor = [0.302 0.302 0.302];
            app.AddDataButton2_2.FontName = 'Calibri';
            app.AddDataButton2_2.FontSize = 18;
            app.AddDataButton2_2.FontColor = [1 1 1];
            app.AddDataButton2_2.Position = [559 265 167 39];
            app.AddDataButton2_2.Text = 'Clear Data';

            % Create FeatureDropDown_2Label_7
            app.FeatureDropDown_2Label_7 = uilabel(app.SIGNIFICANCEANALYSISPanel);
            app.FeatureDropDown_2Label_7.HorizontalAlignment = 'center';
            app.FeatureDropDown_2Label_7.FontName = 'Calibri';
            app.FeatureDropDown_2Label_7.FontSize = 18;
            app.FeatureDropDown_2Label_7.FontColor = [1 1 1];
            app.FeatureDropDown_2Label_7.Position = [566 424 61 24];
            app.FeatureDropDown_2Label_7.Text = 'Feature';

            % Create SigFeatureDropDown
            app.SigFeatureDropDown = uidropdown(app.SIGNIFICANCEANALYSISPanel);
            app.SigFeatureDropDown.Items = {'rms', 'mean', 'max', 'min', 'pt', 'meanP', 'maxP', 'pos_mean', 'neg_mean'};
            app.SigFeatureDropDown.FontName = 'Calibri';
            app.SigFeatureDropDown.FontSize = 18;
            app.SigFeatureDropDown.FontColor = [1 1 1];
            app.SigFeatureDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.SigFeatureDropDown.Position = [635 424 71 25];
            app.SigFeatureDropDown.Value = 'rms';

            % Create NormalityAnaButton
            app.NormalityAnaButton = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.NormalityAnaButton.ButtonPushedFcn = createCallbackFcn(app, @NormalityAnaButtonPushed, true);
            app.NormalityAnaButton.IconAlignment = 'center';
            app.NormalityAnaButton.BackgroundColor = [0.302 0.302 0.302];
            app.NormalityAnaButton.FontName = 'Calibri';
            app.NormalityAnaButton.FontSize = 18;
            app.NormalityAnaButton.FontColor = [1 1 1];
            app.NormalityAnaButton.Position = [559 213 167 39];
            app.NormalityAnaButton.Text = 'Lillietest';

            % Create VarAnaButton
            app.VarAnaButton = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.VarAnaButton.ButtonPushedFcn = createCallbackFcn(app, @VarAnaButtonPushed, true);
            app.VarAnaButton.IconAlignment = 'center';
            app.VarAnaButton.BackgroundColor = [0.302 0.302 0.302];
            app.VarAnaButton.FontName = 'Calibri';
            app.VarAnaButton.FontSize = 18;
            app.VarAnaButton.FontColor = [1 1 1];
            app.VarAnaButton.Position = [559 162 167 39];
            app.VarAnaButton.Text = 'Vartestn';

            % Create VarAnaButton_2
            app.VarAnaButton_2 = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.VarAnaButton_2.ButtonPushedFcn = createCallbackFcn(app, @VarAnaButton_2Pushed, true);
            app.VarAnaButton_2.IconAlignment = 'center';
            app.VarAnaButton_2.BackgroundColor = [0.302 0.302 0.302];
            app.VarAnaButton_2.FontName = 'Calibri';
            app.VarAnaButton_2.FontSize = 18;
            app.VarAnaButton_2.FontColor = [1 1 1];
            app.VarAnaButton_2.Position = [50 32 127 78];
            app.VarAnaButton_2.Text = 'T Test';

            % Create VarAnaButton_3
            app.VarAnaButton_3 = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.VarAnaButton_3.ButtonPushedFcn = createCallbackFcn(app, @VarAnaButton_3Pushed, true);
            app.VarAnaButton_3.IconAlignment = 'center';
            app.VarAnaButton_3.BackgroundColor = [0.302 0.302 0.302];
            app.VarAnaButton_3.FontName = 'Calibri';
            app.VarAnaButton_3.FontSize = 18;
            app.VarAnaButton_3.FontColor = [1 1 1];
            app.VarAnaButton_3.Position = [225 32 127 78];
            app.VarAnaButton_3.Text = 'Anova';

            % Create VarAnaButton_4
            app.VarAnaButton_4 = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.VarAnaButton_4.ButtonPushedFcn = createCallbackFcn(app, @VarAnaButton_4Pushed, true);
            app.VarAnaButton_4.IconAlignment = 'center';
            app.VarAnaButton_4.BackgroundColor = [0.302 0.302 0.302];
            app.VarAnaButton_4.FontName = 'Calibri';
            app.VarAnaButton_4.FontSize = 18;
            app.VarAnaButton_4.FontColor = [1 1 1];
            app.VarAnaButton_4.Position = [575 32 127 78];
            app.VarAnaButton_4.Text = {'Kruskal'; 'Wallis'};

            % Create VarAnaButton_5
            app.VarAnaButton_5 = uibutton(app.SIGNIFICANCEANALYSISPanel, 'push');
            app.VarAnaButton_5.ButtonPushedFcn = createCallbackFcn(app, @VarAnaButton_5Pushed, true);
            app.VarAnaButton_5.IconAlignment = 'center';
            app.VarAnaButton_5.BackgroundColor = [0.302 0.302 0.302];
            app.VarAnaButton_5.FontName = 'Calibri';
            app.VarAnaButton_5.FontSize = 18;
            app.VarAnaButton_5.FontColor = [1 1 1];
            app.VarAnaButton_5.Position = [400 32 127 78];
            app.VarAnaButton_5.Text = {'Mann'; 'Whhitney'; 'Wilcoxon'};

            % Create ToolButtonGroup
            app.ToolButtonGroup = uibuttongroup(app.AnaDataTab);
            app.ToolButtonGroup.BorderType = 'none';
            app.ToolButtonGroup.BackgroundColor = [0.149 0.149 0.149];
            app.ToolButtonGroup.Position = [265 591 30 98];

            % Create LoadTabButton
            app.LoadTabButton = uibutton(app.ToolButtonGroup, 'push');
            app.LoadTabButton.ButtonPushedFcn = createCallbackFcn(app, @LoadTabButtonPushed, true);
            app.LoadTabButton.Icon = 'file (1).png';
            app.LoadTabButton.IconAlignment = 'center';
            app.LoadTabButton.BackgroundColor = [0.251 0.251 0.251];
            app.LoadTabButton.FontName = 'Calibri';
            app.LoadTabButton.FontSize = 18;
            app.LoadTabButton.FontColor = [1 1 1];
            app.LoadTabButton.Tooltip = {'Add Data'};
            app.LoadTabButton.Position = [1 64 30 30];
            app.LoadTabButton.Text = '';

            % Create VarEditTabButton
            app.VarEditTabButton = uibutton(app.ToolButtonGroup, 'push');
            app.VarEditTabButton.ButtonPushedFcn = createCallbackFcn(app, @VarEditTabButtonPushed, true);
            app.VarEditTabButton.Icon = 'edit.png';
            app.VarEditTabButton.IconAlignment = 'center';
            app.VarEditTabButton.BackgroundColor = [0.149 0.149 0.149];
            app.VarEditTabButton.FontName = 'Calibri';
            app.VarEditTabButton.FontSize = 18;
            app.VarEditTabButton.FontColor = [1 1 1];
            app.VarEditTabButton.Tooltip = {'Add Data'};
            app.VarEditTabButton.Position = [1 35 30 30];
            app.VarEditTabButton.Text = '';

            % Create PlotSetTabButton
            app.PlotSetTabButton = uibutton(app.ToolButtonGroup, 'push');
            app.PlotSetTabButton.ButtonPushedFcn = createCallbackFcn(app, @PlotSetTabButtonPushed, true);
            app.PlotSetTabButton.Icon = 'album.png';
            app.PlotSetTabButton.IconAlignment = 'center';
            app.PlotSetTabButton.BackgroundColor = [0.149 0.149 0.149];
            app.PlotSetTabButton.FontName = 'Calibri';
            app.PlotSetTabButton.FontSize = 18;
            app.PlotSetTabButton.FontColor = [1 1 1];
            app.PlotSetTabButton.Tooltip = {'Add Data'};
            app.PlotSetTabButton.Position = [1 6 30 30];
            app.PlotSetTabButton.Text = '';

            % Create ToolTabGroup
            app.ToolTabGroup = uitabgroup(app.AnaDataTab);
            app.ToolTabGroup.TabLocation = 'right';
            app.ToolTabGroup.Position = [296 590 901 100];

            % Create LoadTab
            app.LoadTab = uitab(app.ToolTabGroup);
            app.LoadTab.Title = 'LoadTab';
            app.LoadTab.BackgroundColor = [0.251 0.251 0.251];

            % Create LOADDATAButton
            app.LOADDATAButton = uibutton(app.LoadTab, 'push');
            app.LOADDATAButton.ButtonPushedFcn = createCallbackFcn(app, @LOADDATAButtonPushed, true);
            app.LOADDATAButton.Icon = 'plus-circle-fill.png';
            app.LOADDATAButton.IconAlignment = 'center';
            app.LOADDATAButton.BackgroundColor = [0.251 0.251 0.251];
            app.LOADDATAButton.FontName = 'Calibri';
            app.LOADDATAButton.FontSize = 18;
            app.LOADDATAButton.FontColor = [1 1 1];
            app.LOADDATAButton.Tooltip = {'Add Data'};
            app.LOADDATAButton.Position = [26 25 50 50];
            app.LOADDATAButton.Text = '';

            % Create DELETEDATAButton
            app.DELETEDATAButton = uibutton(app.LoadTab, 'push');
            app.DELETEDATAButton.ButtonPushedFcn = createCallbackFcn(app, @DELETEDATAButtonPushed, true);
            app.DELETEDATAButton.Icon = 'delete_fill.png';
            app.DELETEDATAButton.IconAlignment = 'center';
            app.DELETEDATAButton.BackgroundColor = [0.251 0.251 0.251];
            app.DELETEDATAButton.FontName = 'Calibri';
            app.DELETEDATAButton.FontSize = 18;
            app.DELETEDATAButton.FontColor = [1 1 1];
            app.DELETEDATAButton.Tooltip = {'Delete Data'};
            app.DELETEDATAButton.Position = [106 25 50 50];
            app.DELETEDATAButton.Text = '';

            % Create SAVEVARButton
            app.SAVEVARButton = uibutton(app.LoadTab, 'push');
            app.SAVEVARButton.ButtonPushedFcn = createCallbackFcn(app, @SAVEVARButtonPushed, true);
            app.SAVEVARButton.Icon = 'save1.png';
            app.SAVEVARButton.IconAlignment = 'center';
            app.SAVEVARButton.BackgroundColor = [0.251 0.251 0.251];
            app.SAVEVARButton.FontName = 'Calibri';
            app.SAVEVARButton.FontSize = 18;
            app.SAVEVARButton.FontColor = [1 1 1];
            app.SAVEVARButton.Tooltip = {'Save Data'};
            app.SAVEVARButton.Position = [186 25 50 50];
            app.SAVEVARButton.Text = '';

            % Create ExtractSCONEDataButton
            app.ExtractSCONEDataButton = uibutton(app.LoadTab, 'push');
            app.ExtractSCONEDataButton.ButtonPushedFcn = createCallbackFcn(app, @ExtractSCONEDataButtonPushed, true);
            app.ExtractSCONEDataButton.Icon = 'extract.png';
            app.ExtractSCONEDataButton.IconAlignment = 'center';
            app.ExtractSCONEDataButton.BackgroundColor = [0.251 0.251 0.251];
            app.ExtractSCONEDataButton.FontName = 'Calibri';
            app.ExtractSCONEDataButton.FontSize = 18;
            app.ExtractSCONEDataButton.FontColor = [1 1 1];
            app.ExtractSCONEDataButton.Tooltip = {'Extract SCONE Data'};
            app.ExtractSCONEDataButton.Position = [265 25 50 50];
            app.ExtractSCONEDataButton.Text = '';

            % Create VarEditTab
            app.VarEditTab = uitab(app.ToolTabGroup);
            app.VarEditTab.Title = 'VarEditTab';
            app.VarEditTab.BackgroundColor = [0.251 0.251 0.251];

            % Create DiveideScanButton
            app.DiveideScanButton = uibutton(app.VarEditTab, 'push');
            app.DiveideScanButton.ButtonPushedFcn = createCallbackFcn(app, @DiveideScanButtonPushed, true);
            app.DiveideScanButton.Icon = 'steps.png';
            app.DiveideScanButton.IconAlignment = 'center';
            app.DiveideScanButton.BackgroundColor = [0.251 0.251 0.251];
            app.DiveideScanButton.FontName = 'Calibri';
            app.DiveideScanButton.FontSize = 18;
            app.DiveideScanButton.FontColor = [1 1 1];
            app.DiveideScanButton.Tooltip = {'Divide Scan Data'};
            app.DiveideScanButton.Position = [322 25 50 50];
            app.DiveideScanButton.Text = '';

            % Create DeleteStepsButton
            app.DeleteStepsButton = uibutton(app.VarEditTab, 'push');
            app.DeleteStepsButton.ButtonPushedFcn = createCallbackFcn(app, @DeleteStepsButtonPushed, true);
            app.DeleteStepsButton.Icon = 'table-row-remove.png';
            app.DeleteStepsButton.IconAlignment = 'center';
            app.DeleteStepsButton.BackgroundColor = [0.251 0.251 0.251];
            app.DeleteStepsButton.FontName = 'Calibri';
            app.DeleteStepsButton.FontSize = 18;
            app.DeleteStepsButton.FontColor = [1 1 1];
            app.DeleteStepsButton.Tooltip = {'Delete STEPS'};
            app.DeleteStepsButton.Position = [396 25 50 50];
            app.DeleteStepsButton.Text = '';

            % Create DivideDataButton
            app.DivideDataButton = uibutton(app.VarEditTab, 'push');
            app.DivideDataButton.ButtonPushedFcn = createCallbackFcn(app, @DivideDataButtonPushed, true);
            app.DivideDataButton.Icon = 'divide.png';
            app.DivideDataButton.IconAlignment = 'center';
            app.DivideDataButton.BackgroundColor = [0.251 0.251 0.251];
            app.DivideDataButton.FontName = 'Calibri';
            app.DivideDataButton.FontSize = 18;
            app.DivideDataButton.FontColor = [1 1 1];
            app.DivideDataButton.Tooltip = {'Divide Data'};
            app.DivideDataButton.Position = [174 25 50 50];
            app.DivideDataButton.Text = '';

            % Create MergeDataButton
            app.MergeDataButton = uibutton(app.VarEditTab, 'push');
            app.MergeDataButton.ButtonPushedFcn = createCallbackFcn(app, @MergeDataButtonPushed, true);
            app.MergeDataButton.Icon = 'merge.png';
            app.MergeDataButton.IconAlignment = 'center';
            app.MergeDataButton.BackgroundColor = [0.251 0.251 0.251];
            app.MergeDataButton.FontName = 'Calibri';
            app.MergeDataButton.FontSize = 18;
            app.MergeDataButton.FontColor = [1 1 1];
            app.MergeDataButton.Tooltip = {'Merge Data'};
            app.MergeDataButton.Position = [248 25 50 50];
            app.MergeDataButton.Text = '';

            % Create RenameVarButton
            app.RenameVarButton = uibutton(app.VarEditTab, 'push');
            app.RenameVarButton.ButtonPushedFcn = createCallbackFcn(app, @RenameVarButtonPushed, true);
            app.RenameVarButton.Icon = 'rename.png';
            app.RenameVarButton.IconAlignment = 'center';
            app.RenameVarButton.BackgroundColor = [0.251 0.251 0.251];
            app.RenameVarButton.FontName = 'Calibri';
            app.RenameVarButton.FontSize = 18;
            app.RenameVarButton.FontColor = [1 1 1];
            app.RenameVarButton.Tooltip = {'Rename Variable'};
            app.RenameVarButton.Position = [544 25 50 50];
            app.RenameVarButton.Text = '';

            % Create DelVarButton
            app.DelVarButton = uibutton(app.VarEditTab, 'push');
            app.DelVarButton.ButtonPushedFcn = createCallbackFcn(app, @DelVarButtonPushed, true);
            app.DelVarButton.Icon = 'remove-sign.png';
            app.DelVarButton.IconAlignment = 'center';
            app.DelVarButton.BackgroundColor = [0.251 0.251 0.251];
            app.DelVarButton.FontName = 'Calibri';
            app.DelVarButton.FontSize = 18;
            app.DelVarButton.FontColor = [1 1 1];
            app.DelVarButton.Tooltip = {'Delete Variable'};
            app.DelVarButton.Position = [470 25 50 50];
            app.DelVarButton.Text = '';

            % Create NormalVarButton
            app.NormalVarButton = uibutton(app.VarEditTab, 'push');
            app.NormalVarButton.ButtonPushedFcn = createCallbackFcn(app, @NormalVarButtonPushed, true);
            app.NormalVarButton.Icon = 'divideCal.png';
            app.NormalVarButton.IconAlignment = 'center';
            app.NormalVarButton.BackgroundColor = [0.251 0.251 0.251];
            app.NormalVarButton.FontName = 'Calibri';
            app.NormalVarButton.FontSize = 18;
            app.NormalVarButton.FontColor = [1 1 1];
            app.NormalVarButton.Tooltip = {'Normalize Variable'};
            app.NormalVarButton.Position = [617 25 50 50];
            app.NormalVarButton.Text = '';

            % Create PROCESSButton
            app.PROCESSButton = uibutton(app.VarEditTab, 'push');
            app.PROCESSButton.ButtonPushedFcn = createCallbackFcn(app, @PROCESSButtonPushed, true);
            app.PROCESSButton.Icon = 'process.png';
            app.PROCESSButton.IconAlignment = 'center';
            app.PROCESSButton.BackgroundColor = [0.251 0.251 0.251];
            app.PROCESSButton.FontName = 'Calibri';
            app.PROCESSButton.FontSize = 18;
            app.PROCESSButton.FontColor = [1 1 1];
            app.PROCESSButton.Tooltip = {'Process Data'};
            app.PROCESSButton.Position = [26 25 50 50];
            app.PROCESSButton.Text = {''; ''};

            % Create PROCESSALLButton
            app.PROCESSALLButton = uibutton(app.VarEditTab, 'push');
            app.PROCESSALLButton.ButtonPushedFcn = createCallbackFcn(app, @PROCESSALLButtonPushed, true);
            app.PROCESSALLButton.Icon = 'un-Process-fill.png';
            app.PROCESSALLButton.IconAlignment = 'center';
            app.PROCESSALLButton.BackgroundColor = [0.251 0.251 0.251];
            app.PROCESSALLButton.FontName = 'Calibri';
            app.PROCESSALLButton.FontSize = 18;
            app.PROCESSALLButton.FontColor = [1 1 1];
            app.PROCESSALLButton.Tooltip = {'Process All'};
            app.PROCESSALLButton.Position = [100 25 50 50];
            app.PROCESSALLButton.Text = '';

            % Create BiasVarButton
            app.BiasVarButton = uibutton(app.VarEditTab, 'push');
            app.BiasVarButton.ButtonPushedFcn = createCallbackFcn(app, @BiasVarButtonPushed, true);
            app.BiasVarButton.Icon = 'minus-square.png';
            app.BiasVarButton.IconAlignment = 'center';
            app.BiasVarButton.BackgroundColor = [0.251 0.251 0.251];
            app.BiasVarButton.FontName = 'Calibri';
            app.BiasVarButton.FontSize = 18;
            app.BiasVarButton.FontColor = [1 1 1];
            app.BiasVarButton.Tooltip = {'Normalize Variable'};
            app.BiasVarButton.Position = [692 25 50 50];
            app.BiasVarButton.Text = '';

            % Create PlotSetTab
            app.PlotSetTab = uitab(app.ToolTabGroup);
            app.PlotSetTab.Title = 'PlotSetTab';
            app.PlotSetTab.BackgroundColor = [0.251 0.251 0.251];

            % Create ColorMapAxes
            app.ColorMapAxes = uiaxes(app.PlotSetTab);
            app.ColorMapAxes.FontSize = 1;
            app.ColorMapAxes.XAxisLocation = 'origin';
            app.ColorMapAxes.YAxisLocation = 'origin';
            app.ColorMapAxes.Visible = 'off';
            app.ColorMapAxes.BackgroundColor = [1 1 1];
            app.ColorMapAxes.HandleVisibility = 'off';
            app.ColorMapAxes.Clipping = 'off';
            app.ColorMapAxes.Position = [432 53 325 32];

            % Create Lamp
            app.Lamp = uibutton(app.PlotSetTab, 'push');
            app.Lamp.ButtonPushedFcn = createCallbackFcn(app, @LampPushed3, true);
            app.Lamp.IconAlignment = 'center';
            app.Lamp.BackgroundColor = [0 0.4471 0.7412];
            app.Lamp.FontName = 'Calibri';
            app.Lamp.FontSize = 16;
            app.Lamp.FontColor = [1 1 1];
            app.Lamp.Tooltip = {'SET COLOR'};
            app.Lamp.Position = [432 6 40 40];
            app.Lamp.Text = '';

            % Create Button
            app.Button = uibutton(app.PlotSetTab, 'push');
            app.Button.ButtonPushedFcn = createCallbackFcn(app, @Button_2Pushed2, true);
            app.Button.Icon = 'Arrow, right, next (1).png';
            app.Button.IconAlignment = 'center';
            app.Button.BackgroundColor = [0.302 0.302 0.302];
            app.Button.FontName = 'Calibri';
            app.Button.FontSize = 18;
            app.Button.FontColor = [1 1 1];
            app.Button.Tooltip = {'NEXT COLOR'};
            app.Button.Position = [519 6 30 40];
            app.Button.Text = '';

            % Create Button_3
            app.Button_3 = uibutton(app.PlotSetTab, 'push');
            app.Button_3.ButtonPushedFcn = createCallbackFcn(app, @Button_3Pushed, true);
            app.Button_3.Icon = 'Arrow, left, back.png';
            app.Button_3.IconAlignment = 'center';
            app.Button_3.BackgroundColor = [0.302 0.302 0.302];
            app.Button_3.FontName = 'Calibri';
            app.Button_3.FontSize = 18;
            app.Button_3.FontColor = [1 1 1];
            app.Button_3.Tooltip = {'NEXT COLOR'};
            app.Button_3.Position = [480 6 30 40];
            app.Button_3.Text = '';

            % Create LineWidthDropDownLabel
            app.LineWidthDropDownLabel = uilabel(app.PlotSetTab);
            app.LineWidthDropDownLabel.HorizontalAlignment = 'center';
            app.LineWidthDropDownLabel.FontName = 'Calibri';
            app.LineWidthDropDownLabel.FontColor = [1 1 1];
            app.LineWidthDropDownLabel.Position = [284 74 55 22];
            app.LineWidthDropDownLabel.Text = 'LineWidth';

            % Create LineWidthDropDown
            app.LineWidthDropDown = uidropdown(app.PlotSetTab);
            app.LineWidthDropDown.Items = {'0.5', '1', '2', '3', '4', '5', '8', '10'};
            app.LineWidthDropDown.FontName = 'Calibri';
            app.LineWidthDropDown.FontColor = [1 1 1];
            app.LineWidthDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.LineWidthDropDown.Position = [356 75 62 20];
            app.LineWidthDropDown.Value = '1';

            % Create LineTypeDropDownLabel
            app.LineTypeDropDownLabel = uilabel(app.PlotSetTab);
            app.LineTypeDropDownLabel.HorizontalAlignment = 'center';
            app.LineTypeDropDownLabel.FontName = 'Calibri';
            app.LineTypeDropDownLabel.FontColor = [1 1 1];
            app.LineTypeDropDownLabel.Position = [284 51 48 22];
            app.LineTypeDropDownLabel.Text = 'LineType';

            % Create LineTypeDropDown
            app.LineTypeDropDown = uidropdown(app.PlotSetTab);
            app.LineTypeDropDown.Items = {'-', '--', '-.', ':', 'none'};
            app.LineTypeDropDown.FontName = 'Calibri';
            app.LineTypeDropDown.FontColor = [1 1 1];
            app.LineTypeDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.LineTypeDropDown.Position = [356 52 62 20];
            app.LineTypeDropDown.Value = '-';

            % Create MarkerSizeDropDownLabel
            app.MarkerSizeDropDownLabel = uilabel(app.PlotSetTab);
            app.MarkerSizeDropDownLabel.HorizontalAlignment = 'center';
            app.MarkerSizeDropDownLabel.FontName = 'Calibri';
            app.MarkerSizeDropDownLabel.FontColor = [1 1 1];
            app.MarkerSizeDropDownLabel.Position = [284 26 59 22];
            app.MarkerSizeDropDownLabel.Text = 'MarkerSize';

            % Create MarkerSizeDropDown
            app.MarkerSizeDropDown = uidropdown(app.PlotSetTab);
            app.MarkerSizeDropDown.Items = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '15', '20', '30', '50'};
            app.MarkerSizeDropDown.FontName = 'Calibri';
            app.MarkerSizeDropDown.FontColor = [1 1 1];
            app.MarkerSizeDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.MarkerSizeDropDown.Position = [356 28 62 20];
            app.MarkerSizeDropDown.Value = '1';

            % Create MarkerTypeDropDownLabel
            app.MarkerTypeDropDownLabel = uilabel(app.PlotSetTab);
            app.MarkerTypeDropDownLabel.HorizontalAlignment = 'center';
            app.MarkerTypeDropDownLabel.FontName = 'Calibri';
            app.MarkerTypeDropDownLabel.FontColor = [1 1 1];
            app.MarkerTypeDropDownLabel.Position = [284 4 64 22];
            app.MarkerTypeDropDownLabel.Text = 'MarkerType';

            % Create MarkerTypeDropDown
            app.MarkerTypeDropDown = uidropdown(app.PlotSetTab);
            app.MarkerTypeDropDown.Items = {'o', '+', '*', '.', 'x', 's', 'd', 'p', 'h', 'none'};
            app.MarkerTypeDropDown.FontName = 'Calibri';
            app.MarkerTypeDropDown.FontColor = [1 1 1];
            app.MarkerTypeDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.MarkerTypeDropDown.Position = [356 5 62 20];
            app.MarkerTypeDropDown.Value = 'none';

            % Create ColorMapDropDown
            app.ColorMapDropDown = uidropdown(app.PlotSetTab);
            app.ColorMapDropDown.Items = {};
            app.ColorMapDropDown.ValueChangedFcn = createCallbackFcn(app, @ColorMapDropDownValueChanged, true);
            app.ColorMapDropDown.FontName = 'Calibri';
            app.ColorMapDropDown.FontSize = 18;
            app.ColorMapDropDown.FontColor = [1 1 1];
            app.ColorMapDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.ColorMapDropDown.Position = [636 11 119 30];
            app.ColorMapDropDown.Value = {};

            % Create ColorMapLabel
            app.ColorMapLabel = uilabel(app.PlotSetTab);
            app.ColorMapLabel.HorizontalAlignment = 'center';
            app.ColorMapLabel.FontName = 'Arial';
            app.ColorMapLabel.FontSize = 14;
            app.ColorMapLabel.FontColor = [1 1 1];
            app.ColorMapLabel.Position = [597 4 35 44];
            app.ColorMapLabel.Text = {'Color'; 'Map'};

            % Create NEWButton
            app.NEWButton = uibutton(app.PlotSetTab, 'push');
            app.NEWButton.ButtonPushedFcn = createCallbackFcn(app, @NEWButtonPushed2, true);
            app.NEWButton.Icon = 'square.png';
            app.NEWButton.IconAlignment = 'center';
            app.NEWButton.BackgroundColor = [0.302 0.302 0.302];
            app.NEWButton.FontName = 'Calibri';
            app.NEWButton.FontSize = 18;
            app.NEWButton.FontColor = [1 1 1];
            app.NEWButton.Tooltip = {'NEW Plot'};
            app.NEWButton.Position = [18 20 60 60];
            app.NEWButton.Text = {''; ''};

            % Create NEWSubButton
            app.NEWSubButton = uibutton(app.PlotSetTab, 'push');
            app.NEWSubButton.ButtonPushedFcn = createCallbackFcn(app, @NEWSubButtonPushed, true);
            app.NEWSubButton.Icon = 'apps.png';
            app.NEWSubButton.IconAlignment = 'center';
            app.NEWSubButton.BackgroundColor = [0.302 0.302 0.302];
            app.NEWSubButton.FontName = 'Calibri';
            app.NEWSubButton.FontSize = 18;
            app.NEWSubButton.FontColor = [1 1 1];
            app.NEWSubButton.Tooltip = {'NEW SubPlot'};
            app.NEWSubButton.Position = [92 51 40 40];
            app.NEWSubButton.Text = '';

            % Create SubRowDropDownLabel
            app.SubRowDropDownLabel = uilabel(app.PlotSetTab);
            app.SubRowDropDownLabel.HorizontalAlignment = 'center';
            app.SubRowDropDownLabel.FontName = 'Calibri';
            app.SubRowDropDownLabel.FontSize = 14;
            app.SubRowDropDownLabel.FontColor = [1 1 1];
            app.SubRowDropDownLabel.Position = [146 72 51 20];
            app.SubRowDropDownLabel.Text = 'SubRow';

            % Create SubRowDropDown
            app.SubRowDropDown = uidropdown(app.PlotSetTab);
            app.SubRowDropDown.Items = {'1', '2', '3', '4', '5', '6'};
            app.SubRowDropDown.FontName = 'Calibri';
            app.SubRowDropDown.FontSize = 14;
            app.SubRowDropDown.FontColor = [1 1 1];
            app.SubRowDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.SubRowDropDown.Position = [146 50 51 25];
            app.SubRowDropDown.Value = '1';

            % Create SubColDropDownLabel
            app.SubColDropDownLabel = uilabel(app.PlotSetTab);
            app.SubColDropDownLabel.HorizontalAlignment = 'center';
            app.SubColDropDownLabel.FontName = 'Calibri';
            app.SubColDropDownLabel.FontSize = 14;
            app.SubColDropDownLabel.FontColor = [1 1 1];
            app.SubColDropDownLabel.Position = [141 6 62 20];
            app.SubColDropDownLabel.Text = 'SubCol';

            % Create SubColDropDown
            app.SubColDropDown = uidropdown(app.PlotSetTab);
            app.SubColDropDown.Items = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '10'};
            app.SubColDropDown.FontName = 'Calibri';
            app.SubColDropDown.FontSize = 14;
            app.SubColDropDown.FontColor = [1 1 1];
            app.SubColDropDown.BackgroundColor = [0.2 0.2 0.2];
            app.SubColDropDown.Position = [146 22 51 25];
            app.SubColDropDown.Value = '1';

            % Create SelectButton
            app.SelectButton = uibutton(app.PlotSetTab, 'push');
            app.SelectButton.ButtonPushedFcn = createCallbackFcn(app, @SelectButtonPushed, true);
            app.SelectButton.Icon = 'select.png';
            app.SelectButton.IconAlignment = 'center';
            app.SelectButton.BackgroundColor = [0.302 0.302 0.302];
            app.SelectButton.FontName = 'Calibri';
            app.SelectButton.FontSize = 18;
            app.SelectButton.FontColor = [1 1 1];
            app.SelectButton.Tooltip = {'SELECT Sub Figure'};
            app.SelectButton.Position = [92 7 40 40];
            app.SelectButton.Text = '';

            % Create ClearLastButton
            app.ClearLastButton = uibutton(app.PlotSetTab, 'push');
            app.ClearLastButton.ButtonPushedFcn = createCallbackFcn(app, @ClearLastButtonPushed, true);
            app.ClearLastButton.Icon = 'undo.png';
            app.ClearLastButton.IconAlignment = 'center';
            app.ClearLastButton.BackgroundColor = [0.302 0.302 0.302];
            app.ClearLastButton.FontName = 'Calibri';
            app.ClearLastButton.FontSize = 18;
            app.ClearLastButton.FontColor = [1 1 1];
            app.ClearLastButton.Tooltip = {'CLEAR Last'};
            app.ClearLastButton.Position = [219 51 40 40];
            app.ClearLastButton.Text = '';

            % Create ClearAllButton
            app.ClearAllButton = uibutton(app.PlotSetTab, 'push');
            app.ClearAllButton.ButtonPushedFcn = createCallbackFcn(app, @ClearAllButtonPushed, true);
            app.ClearAllButton.Icon = 'clear.png';
            app.ClearAllButton.IconAlignment = 'center';
            app.ClearAllButton.BackgroundColor = [0.302 0.302 0.302];
            app.ClearAllButton.FontName = 'Calibri';
            app.ClearAllButton.FontSize = 18;
            app.ClearAllButton.FontColor = [1 1 1];
            app.ClearAllButton.Tooltip = {'CLEAR All'};
            app.ClearAllButton.Position = [219 7 40 40];
            app.ClearAllButton.Text = '';

            % Create ReverseCheckBox
            app.ReverseCheckBox = uicheckbox(app.PlotSetTab);
            app.ReverseCheckBox.Text = 'R';
            app.ReverseCheckBox.FontSize = 14;
            app.ReverseCheckBox.FontColor = [1 1 1];
            app.ReverseCheckBox.Position = [558 14 32 22];

            % Create DataTypeTab
            app.DataTypeTab = uitab(app.ToolTabGroup);
            app.DataTypeTab.Title = 'DataTypeTab';
            app.DataTypeTab.BackgroundColor = [0.251 0.251 0.251];

            % Create dSPACEButton
            app.dSPACEButton = uibutton(app.DataTypeTab, 'state');
            app.dSPACEButton.ValueChangedFcn = createCallbackFcn(app, @dSPACEButtonValueChanged, true);
            app.dSPACEButton.Text = 'dSPACE';
            app.dSPACEButton.BackgroundColor = [0.2 0.2 0.2];
            app.dSPACEButton.FontName = 'Calibri';
            app.dSPACEButton.FontSize = 24;
            app.dSPACEButton.FontColor = [1 1 1];
            app.dSPACEButton.Position = [28 25 118 60];

            % Create OpenSimButton
            app.OpenSimButton = uibutton(app.DataTypeTab, 'state');
            app.OpenSimButton.ValueChangedFcn = createCallbackFcn(app, @OpenSimButtonValueChanged, true);
            app.OpenSimButton.Text = 'OpenSim';
            app.OpenSimButton.BackgroundColor = [0.2 0.2 0.2];
            app.OpenSimButton.FontName = 'Calibri';
            app.OpenSimButton.FontSize = 24;
            app.OpenSimButton.FontColor = [1 1 1];
            app.OpenSimButton.Position = [175 25 118 60];

            % Create PredSimButton
            app.PredSimButton = uibutton(app.DataTypeTab, 'state');
            app.PredSimButton.ValueChangedFcn = createCallbackFcn(app, @PredSimButtonValueChanged, true);
            app.PredSimButton.Text = 'PredSim';
            app.PredSimButton.BackgroundColor = [0.2 0.2 0.2];
            app.PredSimButton.FontName = 'Calibri';
            app.PredSimButton.FontSize = 24;
            app.PredSimButton.FontColor = [1 1 1];
            app.PredSimButton.Position = [322 25 118 60];

            % Create SCONEButton
            app.SCONEButton = uibutton(app.DataTypeTab, 'state');
            app.SCONEButton.ValueChangedFcn = createCallbackFcn(app, @SCONEButtonValueChanged, true);
            app.SCONEButton.Text = 'SCONE';
            app.SCONEButton.BackgroundColor = [0.2 0.2 0.2];
            app.SCONEButton.FontName = 'Calibri';
            app.SCONEButton.FontSize = 24;
            app.SCONEButton.FontColor = [1 1 1];
            app.SCONEButton.Position = [468 25 118 60];

            % Create HistoryButton
            app.HistoryButton = uibutton(app.DataTypeTab, 'state');
            app.HistoryButton.ValueChangedFcn = createCallbackFcn(app, @HistoryButtonValueChanged, true);
            app.HistoryButton.Text = 'History';
            app.HistoryButton.BackgroundColor = [0.2 0.2 0.2];
            app.HistoryButton.FontName = 'Calibri';
            app.HistoryButton.FontSize = 24;
            app.HistoryButton.FontColor = [1 1 1];
            app.HistoryButton.Position = [614 25 118 60];

            % Create StepSelectTab
            app.StepSelectTab = uitab(app.ToolTabGroup);
            app.StepSelectTab.Title = 'StepSelectTab';
            app.StepSelectTab.BackgroundColor = [0.251 0.251 0.251];

            % Create SelectstepstodeleteLabel
            app.SelectstepstodeleteLabel = uilabel(app.StepSelectTab);
            app.SelectstepstodeleteLabel.VerticalAlignment = 'top';
            app.SelectstepstodeleteLabel.FontName = 'Calibri';
            app.SelectstepstodeleteLabel.FontSize = 24;
            app.SelectstepstodeleteLabel.FontColor = [1 1 1];
            app.SelectstepstodeleteLabel.Position = [44 21 120 59];
            app.SelectstepstodeleteLabel.Text = {'Select steps'; 'to delete'};

            % Create StepListBox
            app.StepListBox = uilistbox(app.StepSelectTab);
            app.StepListBox.Items = {};
            app.StepListBox.Multiselect = 'on';
            app.StepListBox.FontName = 'Calibri';
            app.StepListBox.FontSize = 18;
            app.StepListBox.FontColor = [1 1 1];
            app.StepListBox.BackgroundColor = [0.502 0.502 0.502];
            app.StepListBox.Position = [183 12 260 76];
            app.StepListBox.Value = {};

            % Create OKButton
            app.OKButton = uibutton(app.StepSelectTab, 'push');
            app.OKButton.ButtonPushedFcn = createCallbackFcn(app, @OKButtonPushed, true);
            app.OKButton.BackgroundColor = [0.302 0.302 0.302];
            app.OKButton.FontName = 'Calibri';
            app.OKButton.FontSize = 18;
            app.OKButton.FontColor = [1 1 1];
            app.OKButton.Position = [475 29 102 42];
            app.OKButton.Text = 'OK';

            % Create CANCELButton
            app.CANCELButton = uibutton(app.StepSelectTab, 'push');
            app.CANCELButton.ButtonPushedFcn = createCallbackFcn(app, @CANCELButtonPushed, true);
            app.CANCELButton.BackgroundColor = [0.302 0.302 0.302];
            app.CANCELButton.FontName = 'Calibri';
            app.CANCELButton.FontSize = 18;
            app.CANCELButton.FontColor = [1 1 1];
            app.CANCELButton.Position = [611 29 102 42];
            app.CANCELButton.Text = 'CANCEL';

            % Create PlotButtonGroup
            app.PlotButtonGroup = uibuttongroup(app.AnaDataTab);
            app.PlotButtonGroup.BorderType = 'none';
            app.PlotButtonGroup.BackgroundColor = [0.149 0.149 0.149];
            app.PlotButtonGroup.Position = [265 442 30 129];

            % Create SIGNFIButton
            app.SIGNFIButton = uibutton(app.PlotButtonGroup, 'push');
            app.SIGNFIButton.ButtonPushedFcn = createCallbackFcn(app, @SIGNFIButtonPushed, true);
            app.SIGNFIButton.Icon = 'box-plot.png';
            app.SIGNFIButton.IconAlignment = 'center';
            app.SIGNFIButton.BackgroundColor = [0.2 0.2 0.2];
            app.SIGNFIButton.FontName = 'Calibri';
            app.SIGNFIButton.FontSize = 20;
            app.SIGNFIButton.FontWeight = 'bold';
            app.SIGNFIButton.FontColor = [1 1 1];
            app.SIGNFIButton.Tooltip = {'Bar Plot'};
            app.SIGNFIButton.Position = [1 8 30 30];
            app.SIGNFIButton.Text = '';

            % Create FITTINGButton
            app.FITTINGButton = uibutton(app.PlotButtonGroup, 'push');
            app.FITTINGButton.ButtonPushedFcn = createCallbackFcn(app, @FITTINGButtonPushed, true);
            app.FITTINGButton.Icon = 'fitting.png';
            app.FITTINGButton.IconAlignment = 'center';
            app.FITTINGButton.BackgroundColor = [0.2 0.2 0.2];
            app.FITTINGButton.FontName = 'Calibri';
            app.FITTINGButton.FontSize = 20;
            app.FITTINGButton.FontWeight = 'bold';
            app.FITTINGButton.FontColor = [1 1 1];
            app.FITTINGButton.Tooltip = {'Bar Plot'};
            app.FITTINGButton.Position = [1 37 30 30];
            app.FITTINGButton.Text = '';

            % Create GROUPBARButton
            app.GROUPBARButton = uibutton(app.PlotButtonGroup, 'push');
            app.GROUPBARButton.ButtonPushedFcn = createCallbackFcn(app, @GROUPBARButtonPushed, true);
            app.GROUPBARButton.Icon = 'BarChart.png';
            app.GROUPBARButton.IconAlignment = 'center';
            app.GROUPBARButton.BackgroundColor = [0.2 0.2 0.2];
            app.GROUPBARButton.FontName = 'Calibri';
            app.GROUPBARButton.FontSize = 20;
            app.GROUPBARButton.FontWeight = 'bold';
            app.GROUPBARButton.FontColor = [1 1 1];
            app.GROUPBARButton.Tooltip = {'Bar Plot'};
            app.GROUPBARButton.Position = [1 66 30 30];
            app.GROUPBARButton.Text = '';

            % Create PLOTButton
            app.PLOTButton = uibutton(app.PlotButtonGroup, 'push');
            app.PLOTButton.ButtonPushedFcn = createCallbackFcn(app, @PLOTButtonPushed, true);
            app.PLOTButton.Icon = 'line chart.png';
            app.PLOTButton.IconAlignment = 'center';
            app.PLOTButton.BackgroundColor = [0.2 0.2 0.2];
            app.PLOTButton.FontName = 'Calibri';
            app.PLOTButton.FontSize = 1;
            app.PLOTButton.FontWeight = 'bold';
            app.PLOTButton.FontColor = [0.2 0.2 0.2];
            app.PLOTButton.Tooltip = {'Line Plot'};
            app.PLOTButton.Position = [1 95 30 30];
            app.PLOTButton.Text = '';

            % Create BACKButton
            app.BACKButton = uibutton(app.AnaDataTab, 'push');
            app.BACKButton.ButtonPushedFcn = createCallbackFcn(app, @BACKButtonPushed, true);
            app.BACKButton.Icon = 'home (1).png';
            app.BACKButton.IconAlignment = 'center';
            app.BACKButton.BackgroundColor = [0.2 0.2 0.2];
            app.BACKButton.FontName = 'Calibri';
            app.BACKButton.FontSize = 20;
            app.BACKButton.FontWeight = 'bold';
            app.BACKButton.FontColor = [0.2 0.2 0.2];
            app.BACKButton.Tooltip = {'Home'};
            app.BACKButton.Position = [75 0 30 30];
            app.BACKButton.Text = {''; ''};

            % Create GlobalSetTab
            app.GlobalSetTab = uitab(app.TabGroup);
            app.GlobalSetTab.Title = 'GlobalSetTab';
            app.GlobalSetTab.BackgroundColor = [0.149 0.149 0.149];

            % Create SetBalckColor
            app.SetBalckColor = uibutton(app.GlobalSetTab, 'push');
            app.SetBalckColor.ButtonPushedFcn = createCallbackFcn(app, @SetBalckColorButtonPushed, true);
            app.SetBalckColor.BackgroundColor = [0.149 0.149 0.149];
            app.SetBalckColor.FontName = 'Calibri';
            app.SetBalckColor.FontSize = 18;
            app.SetBalckColor.FontColor = [1 1 1];
            app.SetBalckColor.Position = [135 579 70 50];
            app.SetBalckColor.Text = '';

            % Create BACKButton_2
            app.BACKButton_2 = uibutton(app.GlobalSetTab, 'push');
            app.BACKButton_2.ButtonPushedFcn = createCallbackFcn(app, @BACKButtonPushed, true);
            app.BACKButton_2.Icon = 'home (1).png';
            app.BACKButton_2.IconAlignment = 'center';
            app.BACKButton_2.BackgroundColor = [0.2 0.2 0.2];
            app.BACKButton_2.FontName = 'Calibri';
            app.BACKButton_2.FontSize = 20;
            app.BACKButton_2.FontWeight = 'bold';
            app.BACKButton_2.FontColor = [0.2 0.2 0.2];
            app.BACKButton_2.Tooltip = {'Home'};
            app.BACKButton_2.Position = [2 357 30 30];
            app.BACKButton_2.Text = {''; ''};

            % Create SetBalckColor_2
            app.SetBalckColor_2 = uibutton(app.GlobalSetTab, 'push');
            app.SetBalckColor_2.ButtonPushedFcn = createCallbackFcn(app, @SetBalckColor_2ButtonPushed, true);
            app.SetBalckColor_2.BackgroundColor = [0.4588 0.6196 0.8];
            app.SetBalckColor_2.FontName = 'Calibri';
            app.SetBalckColor_2.FontSize = 18;
            app.SetBalckColor_2.FontColor = [1 1 1];
            app.SetBalckColor_2.Position = [273 579 70 50];
            app.SetBalckColor_2.Text = '';

            % Create SetBalckColor_3
            app.SetBalckColor_3 = uibutton(app.GlobalSetTab, 'push');
            app.SetBalckColor_3.ButtonPushedFcn = createCallbackFcn(app, @SetBalckColor_3ButtonPushed, true);
            app.SetBalckColor_3.BackgroundColor = [0.3216 0.451 0.302];
            app.SetBalckColor_3.FontName = 'Calibri';
            app.SetBalckColor_3.FontSize = 18;
            app.SetBalckColor_3.FontColor = [1 1 1];
            app.SetBalckColor_3.Position = [408 579 70 50];
            app.SetBalckColor_3.Text = '';

            % Create SetBalckColor_4
            app.SetBalckColor_4 = uibutton(app.GlobalSetTab, 'push');
            app.SetBalckColor_4.ButtonPushedFcn = createCallbackFcn(app, @SetBalckColor_4ButtonPushed, true);
            app.SetBalckColor_4.BackgroundColor = [0.9686 0.6314 0.8196];
            app.SetBalckColor_4.FontName = 'Calibri';
            app.SetBalckColor_4.FontSize = 18;
            app.SetBalckColor_4.FontColor = [1 1 1];
            app.SetBalckColor_4.Position = [550 579 70 50];
            app.SetBalckColor_4.Text = '';

            % Create SetBalckColor_5
            app.SetBalckColor_5 = uibutton(app.GlobalSetTab, 'push');
            app.SetBalckColor_5.ButtonPushedFcn = createCallbackFcn(app, @SetBalckColor_5ButtonPushed, true);
            app.SetBalckColor_5.BackgroundColor = [0.502 0.4706 0.8196];
            app.SetBalckColor_5.FontName = 'Calibri';
            app.SetBalckColor_5.FontSize = 18;
            app.SetBalckColor_5.FontColor = [1 1 1];
            app.SetBalckColor_5.Position = [708 579 70 50];
            app.SetBalckColor_5.Text = '';

            % Create SetBalckColor_6
            app.SetBalckColor_6 = uibutton(app.GlobalSetTab, 'push');
            app.SetBalckColor_6.BackgroundColor = [0.149 0.149 0.149];
            app.SetBalckColor_6.FontName = 'Calibri';
            app.SetBalckColor_6.FontSize = 18;
            app.SetBalckColor_6.FontColor = [1 1 1];
            app.SetBalckColor_6.Position = [860 579 70 50];
            app.SetBalckColor_6.Text = '';

            % Show the figure after all components are created
            app.DPAS102LabUIFigure.Visible = 'on';
        end
    end

    % App creation and deletion
    methods (Access = public)

        % Construct app
        function app = DPAS_for_102Lab

            % Create UIFigure and components
            createComponents(app)

            % Register the app with App Designer
            registerApp(app, app.DPAS102LabUIFigure)

            % Execute the startup function
            runStartupFcn(app, @startupFcn)

            if nargout == 0
                clear app
            end
        end

        % Code that executes before app deletion
        function delete(app)

            % Delete UIFigure when app is deleted
            delete(app.DPAS102LabUIFigure)
        end
    end
end