gui_generate.m

来自「主成分分析和偏最小二乘SquaresPrincipal成分分析( PCA )和偏」· M 代码 · 共 83 行

M
83
字号
function gui_generate(P);
% P-{1-discrete map
%    2-continuous system
%    3-SDE}

% last modified 28.08.07

global TS GSD_GLOBALS

switch P
    case 1
        data=map_solver;
        str_id='map_';
    case 2
        data=ode_solver;
        str_id='sys_';
    case 3
        data=sde_solver;
        str_id='sde_';
end

if ~isempty(data)
    if isempty(TS)
        [x,y]=size(data);
        if P==1
            TS.data=data;
            for i=1:y
                TS.name{i}=[str_id num2str(i)];
            end
            TS.time=(1:x)';
        else
            TS.data=data(:,2:end);
            for i=1:y-1
                TS.name{i}=[str_id num2str(i)];
            end
            TS.time=data(:,1);
        end
        h=findobj('tag','MainFig');
        if ~isempty(h)
            set(h,'name','Lab432 [Generated time series]');
        end
        GSD_GLOBALS.en_dis.datapresent=1;
        gui_en_dis;
    else
        ld=length(data(:,1));
        lT=length(TS.data(:,1));
        if ld>lT
            button = questdlg('Generated time series has greater length than existed ones. Crop generated series?',...
                'Continue Operation','Crop from the beginning','Crop from the end','Cancel','Crop from the beginning');
            if strcmp(button,'Crop from the beginning')
                data=data(ld-lT+1:end,:);
            elseif strcmp(button,'Crop from the end')
                data=data(1:lT:end,:);
            elseif strcmp(button,'Cancel')
                return
            end
        elseif ld<lT
            button = questdlg('Existed time series has greater length than generated ones. Crop existed series?',...
                'Continue Operation','Crop from the beginning','Crop from the end','Cancel','Crop from the beginning');
            if strcmp(button,'Crop from the beginning')
                TS.data=TS.data(lT-ld+1:end,:);
                TS.time=TS.time(lT-ld+1:end,:);
            elseif strcmp(button,'Crop from the end')
                TS.data=TS.data(1:ld,:);
                TS.time=TS.time(1:ld,:);
            elseif strcmp(button,'Cancel')
                return
            end
        end
        TS.data=[TS.data data];
        k=length(TS.name);
        if P==1
            for i=1:length(data(1,:))
                TS.name{k+i}=[str_id num2str(i)];
            end
        else
            TS.name{k+1}=[str_id '{time}'];
            for i=1:(length(data(1,:))-1)
                TS.name{k+1+i}=[str_id num2str(i)];
            end
        end
    end
end

⌨️ 快捷键说明

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