public void train()
        {
            dotnetclass AClass = new dotnetclass();

            int s_id = 1;

            while (s_id < 6)
            {
                MWNumericArray subj_id = new MWNumericArray(s_id);
                StreamReader sr = new StreamReader("ecg" + s_id + ".txt");

                while (sr.Peek() != -1)
                {
                    double[] ecg = new double[1280];
                    string line;
                    int i = 0;
                    int b = 0;
                    for (i = 0; i < 1280; i++)
                    {
                        if ((line = sr.ReadLine()) != null)
                        {
                            if (String.IsNullOrWhiteSpace(line))
                            {
                                b = 1;
                                break;
                            }
                            double line1 = Convert.ToDouble(line);
                            ecg[i] = line1;
                        }
                    }
                    if (b == 1) break;
                    MWNumericArray ecg_raw = new MWNumericArray(1280, 1, ecg);
                    MWArray RetVal = AClass.process(ecg_raw, M);

                    MWArray gal = new MWNumericArray();
                    gal = gallery;
                    gallery = AClass.addtogallery(gal, RetVal);

                    MWArray id_temp = new MWNumericArray();
                    id_temp = id;
                    id = AClass.addtoid(id_temp, subj_id);
                }
                if (sr != null) sr.Close();
                s_id++;
            }
            weights = AClass.dlda(gallery, id);
            projected_gallery = AClass.projection(gallery, weights);
        }