示例#1
0
        internal ArrayReader(string fileName)
        {
            try
            {
                MatFileReader mfr = new MatFileReader(fileName);
                A = ((MLDouble)(mfr.GetMLArray("A"))).GetArray();
                PP = ((MLDouble)(mfr.GetMLArray("PP"))).GetArray();
                double[][] Q = ((MLDouble)(mfr.GetMLArray("q"))).GetArray();
                q = new double[Q.Length];
                for (int i = 0; i < Q.Length; i++)
                {
                    q[i] = Q[i][0];
                }

                double[][] P = ((MLDouble)mfr.GetMLArray("p")).GetArray();
                p = new double[P.Length];
                for (int i = 0; i < P.Length; i++)
                {
                    p[i] = P[i][0];
                }
                double[][] V = ((MLDouble)mfr.GetMLArray("v")).GetArray();
                v = new double[V.Length];
                for (int i = 0; i < V.Length; i++)
                {
                    v[i] = V[i][0];
                }

                double[][] WW = ((MLDouble)mfr.GetMLArray("w")).GetArray();
                w = new double[WW.Length];
                for (int i = 0; i < WW.Length; i++)
                {
                    w[i] = WW[i][0];
                }
            }
            catch (System.IO.IOException)
            {
                throw new MatlabIOException("Cannot read file");
            }
        }
 /// <summary>
 /// This method provides stimuli data. 
 /// </summary>
 /// <returns>
 /// Returns stimuli which triggered spikes delivered by the GetSpikes-method.
 /// 
 /// Dimension of the returned array:
 /// 1 - Presented frames.
 /// 2 - Presented bars per frame (1 represents white bar, -1 represents black bar).
 /// </returns>
 public static double[][] GetStimuli()
 {
     //var reader = new MatFileReader(@"F:\Development\Uni\Nonlinearities\Data\Long Experiment\msq1D.mat");
     var reader = new MatFileReader(@"..\..\..\Data\Long Experiment\msq1D.mat");
     return ((MLDouble)reader.GetMLArray("msq1D")).GetArray();
 }