|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
本帖最后由 uiabluqp 于 2020-10-20 17:05 编辑 ( f1 s! `# g& Z3 T; ^! [, a! o% P
8 U) [7 a& }4 f5 M- t=timer();
- t.StartDelay = 0;%延时1秒开始
- t.ExecutionMode = 'fixedRate';%启用循环执行
- t.Period = 1;%循环间隔2秒
- t.TasksToExecute = inf;%循环次数无限
- t.TimeRFcn = @(~,~)tianshi;
- start(t);
- function tianshi
- clc;
- K=exist('C:\Program Files (x86)\MetaTrader 4 IC Markets\MQL4\Files\EURJPY\z_kongzhi.csv');
- if K==2
- close all;
- clear;
- tic;
- format compact;
- %% 处理数据
- gril=csvread('C:\Program Files (x86)\MetaTrader 4 IC Markets\MQL4\Files\EURJPY\sc_s.csv');
- boy=csvread('C:\Program Files (x86)\MetaTrader 4 IC Markets\MQL4\Files\EURJPY\sc_b.csv');
- xingbie_s=csvread('C:\Program Files (x86)\MetaTrader 4 IC Markets\MQL4\Files\EURJPY\sc_ybs.csv');
- xingbie_b=csvread('C:\Program Files (x86)\MetaTrader 4 IC Markets\MQL4\Files\EURJPY\sc_ybb.csv');
- [sc_ssr,sc_ssc]=size(gril);
- [sc_bsr,sc_bsc]=size(boy);
- scs_r=round(sc_ssr/4);
- sxl_r=sc_ssr-scs_r;
- bcs_r=round(sc_bsr/4);
- bxl_r=sc_bsr-bcs_r;
- xingbie=[xingbie_s;xingbie_b];
- dataset = [gril;boy];
- train_set = [dataset(1:sxl_r,: );dataset(sc_ssr+1:sc_ssr+bxl_r,: )]; %%1到3为gril的训练集,7到8为boy的训练集
- train_set_labels = [xingbie(1:sxl_r);xingbie(sc_ssr+1:sc_ssr+bxl_r)]; %%1到3为gril的训练集样本,7到8为boy的训练样本
- test_set = [dataset(sxl_r+1:sc_ssr,: );dataset(sc_ssr+bxl_r+1:sc_ssr+sc_bsr,: )];
- test_set_labels = [xingbie(sxl_r+1:sc_ssr);xingbie(sc_ssr+bxl_r+1:sc_ssr+sc_bsr)];
- %% 归一化
- [mtrain,ntrain] = size(train_set);
- [mtest,ntest] = size(test_set);
- test_dataset = [train_set;test_set];
- [dataset_scale,ps] = mapminmax(test_dataset',0,1);
- dataset_scale = dataset_scale';
- train_set = dataset_scale(1:mtrain,: );
- test_set = dataset_scale( (mtrain+1): (mtrain+mtest),: );
- %% 归一化测试
- xingbiecheshi=csvread('C:\Program Files (x86)\MetaTrader 4 IC Markets\MQL4\Files\EURJPY\sc_dx.csv');
- [mtest_1,ntest_1] = size(xingbiecheshi);
- test_dataset_1 = [xingbiecheshi];
- [dataset_scale_1,ps] = mapminmax(test_dataset_1',0,1);
- dataset_scale_1 = dataset_scale_1';
- test_set_1 = dataset_scale_1( 1:mtest_1,: );
- bb=[train_set_labels train_set];
- SPECTF = bb;
- labels = SPECTF(:, 1); % labels from the 1st column
- features = SPECTF(:, 2:end);
- features_sparse = sparse(features); % features must be in a sparse matrix
- libsvmwrite('C:\Program Files (x86)\MetaTrader 4 IC Markets\MQL4\Files\EURJPY\h.txt', labels, features_sparse);
- aa=[test_set_labels test_set];
- SPECTF_1 = aa;
- labels = SPECTF_1(:, 1); % labels from the 1st column
- features = SPECTF_1(:, 2:end);
- features_sparse = sparse(features); % features must be in a sparse matrix
- libsvmwrite('C:\Program Files (x86)\MetaTrader 4 IC Markets\MQL4\Files\EURJPY\t.txt', labels, features_sparse);
- cc=[0 test_set_1];
- SPECTF_3 = cc;
- labels = SPECTF_3(:, 1); % labels from the 1st column
- features = SPECTF_3(:, 2:end);
- features_sparse = sparse(features); % features must be in a sparse matrix
- libsvmwrite('C:\Program Files (x86)\MetaTrader 4 IC Markets\MQL4\Files\EURJPY\p.txt', labels, features_sparse);
- cd 'C:\Program Files (x86)\MetaTrader 4 IC Markets\MQL4\Files\EURJPY\';
- delete z_kongzhi.csv;
- end
- end5 }) t6 ~' `" L- X( G7 N
8 ~/ ^ m! o+ P/ d
5 _" }& k1 L |8 o& i/ }
- Q% ?% v4 m( G) g& ^3 e5 A将上面的文件使用MCC编译成EXE文件,但是不知道为什么执行一次之后,命令窗口直接关闭了,不会循环这是什么?能否有大神能教教我
4 P" y, ~6 u. q6 e, S8 |0 O$ {8 W8 }; v) B0 `9 O# h7 w
|
|