ccl_data_read_save(x,y,z,N,name) Data preparation for CCL learning Input: x,y,z Real data in column N Number of data remain name Name of the generated file
0001 function ccl_data_read_save(x,y,z,N,name) 0002 % ccl_data_read_save(x,y,z,N,name) 0003 % 0004 % Data preparation for CCL learning 0005 % 0006 % Input: 0007 % 0008 % x,y,z Real data in column 0009 % N Number of data remain 0010 % name Name of the generated file 0011 0012 0013 0014 0015 % CCL: A MATLAB library for Constraint Consistent Learning 0016 % Copyright (C) 2007 Matthew Howard 0017 % Contact: matthew.j.howard@kcl.ac.uk 0018 % 0019 % This library is free software; you can redistribute it and/or 0020 % modify it under the terms of the GNU Lesser General Public 0021 % License as published by the Free Software Foundation; either 0022 % version 2.1 of the License, or (at your option) any later version. 0023 % 0024 % This library is distributed in the hope that it will be useful, 0025 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0026 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0027 % Lesser General Public License for more details. 0028 % 0029 % You should have received a copy of the GNU Library General Public 0030 % License along with this library; if not, write to the Free 0031 % Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 0032 0033 N_ = size(x,1); 0034 data.N = N; 0035 ind = floor((N_-N)/2):(floor((N_-N)/2)+N-1); 0036 data.X = [x';y';z']; 0037 data.Y = [diff(data.X')/0.02]'; 0038 data.Y = [reshape(smooth(data.Y',10),size(data.Y,2),size(data.Y,1))]'; 0039 data.F = zeros(3,N); 0040 data.A = zeros(1,3,N); 0041 data.P = zeros(3,3,N); 0042 data.X = data.X(:,ind); 0043 data.Y = data.Y(:,ind); 0044 figure;scatter3(data.X(1,:),data.X(2,:),data.X(3,:)); 0045 xlabel('x');ylabel('y');zlabel('z');zlim([0,1]) 0046 ccl_data_save(name,data); 0047 end