diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-05-12 13:57:52 +0200 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-05-12 13:57:52 +0200 |
commit | 52f959aad90f9d118f6d23ee2d81c98770104074 (patch) | |
tree | 94ec41fe21d29f4cbd0fefbb7bae3ff86baadefc | |
parent | a2ef6de02ce62d2d2d878632cb52099e6e4c227f (diff) | |
download | dmc-52f959aad90f9d118f6d23ee2d81c98770104074.tar.gz dmc-52f959aad90f9d118f6d23ee2d81c98770104074.tar.bz2 dmc-52f959aad90f9d118f6d23ee2d81c98770104074.zip |
get_products: Use reshape to generate the day by product matrix
-rw-r--r-- | get_products.m | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/get_products.m b/get_products.m index eed1c00..86668de 100644 --- a/get_products.m +++ b/get_products.m @@ -2,18 +2,6 @@ function [A,B] = get_products() load('-ascii', 'train_noheader.csv'); load('-ascii', 'class_noheader.csv'); - A = zeros(42+14, 570); - B = zeros(42, 570); - for i = 1:42 - begin = 570 * (i-1) + 1; - ende = begin + 569; - A(i,:) = train_noheader(begin:ende,3)'; - B(i,:) = train_noheader(begin:ende,4)'; - end - for i = 43:56 - begin = 570 * (i-42-1) + 1; - ende = begin + 569; - A(i,:) = class_noheader(begin:ende,3)'; - end - + A = reshape([train_noheader(:,3); class_noheader(:,3)], 570, [])'; + B = reshape( train_noheader(:,4), 570, [])'; endfunction |