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

📄 da_tshft.m

📁 收集的GA的一些源程序
💻 M
字号:
%
% da_tshft.m
%
% Programme to time shift a data
% set
%

%
% Sort the screen out
%
da_front;
set(w1,'NumberTitle','off','Name','Timeshifting Data Set');
drawnow;

%
% Initialise the time delay matrix to all zeros
%
[D L]=size(data);
time_delays=zeros(1,L);

%
% Some text objects
%
text1=da_text(w1,60,300,120,15,'Current variable :',[1 1 1],[0 0 1]);
text2=da_text(w1,190,300,30,15,'1',[1 1 1],[1 0 0]);
text3=da_text(w1,60,250,120,15,'Time delay       :',[1 1 1],[0 0 1]);

%
% Edit box for time delay
%
text4=uicontrol(w1,...
	'style','edit',...
	'position',[190 250 30 15],...
	'backgroundcolor',[1 0 0],...
	'foregroundcolor',[1 1 1],...
	'string','0',...
	'callback',[
		'a=get(text4,''string'');',...
		'a=str2num(a);',...
		'if a ~= [];',...
			'set(text4,''string'',num2str(a));',...
			'time_delays(sl1_value)=a;',...
		'else;',...
			'set(text4,''string'',''0'');',...
			'time_delays(sl1_value)=0;',...
		'end']);

%
% Draw a slider to select a variable
%
sl1_value=1;
old_sl1_value=1;
sl1=uicontrol(w1,...
	'style','slider',...
	'position',[250 170 200 20],...
	'min',1,...
	'max',L,...
	'value',0,...
	'callback',[
		'sl1_value=ceil(get(sl1,''value''));',...
		'if sl1_value ~= old_sl1_value;',...
			'old_sl1_value=sl1_value;',...
			'set(text2,''string'',num2str(sl1_value));',...
			'set(text4,''string'',num2str(time_delays(sl1_value)));',...
			'set(sl1_current,''string'',[''Variable = '' num2str(sl1_value)]);',...
		'end;']);

sl1_title=da_text(w1,50,170,200,15,'Currently selected variable',[1 1 1],[0 0 0]);
sl1_current=da_text(w1,380,200,140,15,'Variable = 1',[1 1 1],[0 0 0]);


%
% Shift button
%
but1=uicontrol(w1,...
	'style','push',...
	'position',[230 100 120 40],...
	'string','SHIFT data matrix',...
	'callback',[
		'data=timeshft(data,time_delays);',...
		'text5=da_text(w1,220,50,150,15,''Data file modified OK'',[1 1 1],[1 0 0]);']);

⌨️ 快捷键说明

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