Encog.Util.CSV.ReadCSV.Next C# (CSharp) Method

Next() public method

Read the next line.
public Next ( ) : bool
return bool
        public bool Next()
        {
            try
            {
                String line;

                do
                {
                    line = _reader.ReadLine();
                } while ((line != null) && line.Trim().Length == 0);

                if (line == null)
                {
                    return false;
                }

                if (_data == null)
                {
                    InitData(line);
                }

                IList<String> tok = Parse(line);

                int i = 0;
                foreach (String str in tok)
                {
                    if (i < _data.Length)
                    {
                        _data[i++] = str;
                    }
                }

                return true;
            }
            catch (IOException e)
            {
#if logging
                if (logger.IsErrorEnabled)
                {
                    logger.Error("Exception", e);
                }
#endif
                throw new EncogError(e);
            }
        }

Usage Example

Ejemplo n.º 1
0
        protected override void LoadTestData(string testFile)
        {
            ReadCSV test_csv = new ReadCSV(testFile, true, CSVFormat.DecimalPoint);

            List<double[]> test_input = new List<double[]>();
            test_input_orig = new List<double[]>();

            while (test_csv.Next())
            {
                double x = test_csv.GetDouble(0);

                test_input.Add(new[] { x });
                test_input_orig.Add(new[] { x });
            }

            test_csv.Close();

            //Analyze(ref test_input);
            Normalize(ref test_input, ref vmin, ref vmax);

            testData = new List<IMLData>();
            foreach (var d in test_input)
            {
                testData.Add(new BasicMLData(d));
            }
        }
All Usage Examples Of Encog.Util.CSV.ReadCSV::Next