Matlab – How to format data for use in nntool (MATLAB)

formattingmatlabneural-networknntool

In nntool, the sample data is formatted as: [0 1 -1; 2 3 1]

I have ~8000 data points in a text file.
How do I format those points for use here? What does the semicolon signify?

Best Solution

From this example, that would mean each column of the input data would be separated by a ;. The Target data would be a vector like [1 2 3 4] corresponding to each row of the input data.

E.g. if you want to learn the XOR truth table:

X Y XOR
0 0 0
0 1 1
1 0 1
1 1 0

Then the Input matrix is

X Y 
0 0 
0 1 
1 0 
1 1 

And the Target is

XOR
0
1
1
0

And therefore, your data should be formatted as [0 0 1 1;0 1 0 1] for the input (each column is separated by a ;) and the target data would be [0 1 1 0].

As far as your 8000 point data file is concerned, you can load it into a variable in your workspace and let nntool read the input matrix from your workspace or a .mat file (after you've saved the variable into it).