2016-05-18 6 views
0

私はRBFニューラルネットワークを作成してトレーニングするために.datファイルのデータを使用しようとしています。しかし、私はそれの列を使用する方法を知らない入力ターゲットネットワーク内のデータです。Matlab:ニューラルネットワークで.datファイルを使用するには?

これは、MathWorks社のMATLABでのファイルの画像です: train.dat

私はこの試みた:私の質問は、私はtrain.datを開くために最初に書くべきコードである

fid = fopen('train.dat','r'); 
A = fscanf(fid, '%f'); 
C1 = textscan(fid,'%s%f%s%f'); %read the first line 
nb_col = C1{4};      %get the number of columns (could be set by user too) 

%read the remaining of the file 
C2 = textscan(fid, repmat('%f',1,nb_col), 'CollectOutput',1); 

fclose(fid);      %close the connection 

ファイルを作成し、最初の列をベクトル(パターン)に入れ、それを別のベクトル(ターゲット)の3番目の列に入れますか?

答えて

0

私はこれが機能するかどうかわからないが、あなたは試すことができます:

load train.dat 
patterns = train(:,1); % If just first column 
patterns = train(:,[1:2]); % If column 1 & 2 are the vector patterns 
target = train(:,3); 
関連する問題