Пример #1
0
        public static void Extract2AcFile(float[][][] matrix, int[] indexes, string varName, int varIndex, string acfile)
        {
            int steps = matrix[0].Length;
            int nfea  = indexes.Length;

            float[][][] ac = new float[1][][];
            ac[0] = new float[steps][];
            for (int s = 0; s < steps; s++)
            {
                ac[0][s] = new float[nfea];
            }
            for (int s = 0; s < steps; s++)
            {
                for (int i = 0; i < nfea; i++)
                {
                    ac[0][s][i] = matrix[varIndex][s][indexes[i]];
                }
            }
            AcFile acf = new AcFile();

            acf.Save(acfile, ac, new string[] { varName });
            ac = null;
        }
Пример #2
0
        /// <summary>
        /// extract subset from the given matrix and save it to a ac file
        /// </summary>
        /// <param name="serialMatrix">2D serial matrix</param>
        /// <param name="indexes">indexes of subset</param>
        /// <param name="varName">name of variable</param>
        /// <param name="acfile">ac filename</param>
        public static void Extract2AcFile(MatrixCube <float> serialMatrix, int[] indexes, string varName, string acfile)
        {
            int steps = serialMatrix.LayeredSerialValue.Length;
            int nfea  = indexes.Length;

            float[][][] ac = new float[1][][];
            ac[0] = new float[steps][];
            for (int s = 0; s < steps; s++)
            {
                ac[0][s] = new float[nfea];
            }
            for (int s = 0; s < steps; s++)
            {
                for (int i = 0; i < nfea; i++)
                {
                    ac[0][s][i] = serialMatrix.LayeredSerialValue[s][indexes[i]];
                }
            }
            AcFile acf = new AcFile();

            acf.Save(acfile, ac, new string[] { varName });
            ac = null;
        }