示例#1
0
            ///// <summary>
            ///// Gets the size of the <c>ISMatTag</c>
            ///// </summary>
            //public int Size
            //{
            //    get { return (int)Buf.BaseStream.Length; }
            //}

            /// <summary>
            /// Read MAT-file tag to a byte buffer.
            /// </summary>
            /// <param name="buff"><c>ByteBuffer</c></param>
            /// <param name="storage"><c>ByteStorageSupport</c></param>
            public void ReadToByteBuffer(ByteBuffer buff, IByteStorageSupport storage)
            {
                MatFileInputStream mfis = new MatFileInputStream(this.Buf, this._type);
                int elements            = this._size / this.SizeOf();

                mfis.ReadToByteBuffer(buff, elements, storage);
                //skip padding
                if (this.padding > 0)
                {
                    this.Buf.ReadBytes(this.padding);
                }
            }
示例#2
0
            /// <summary>
            /// Read MAT-file tag to a <c>char</c> array
            /// </summary>
            /// <returns><c>int[]</c></returns>
            public char[] ReadToCharArray()
            {
                // allocate memory for array elements
                int elements = this._size / this.SizeOf();

                char[] ac = new char[elements];

                MatFileInputStream mfis = new MatFileInputStream(this.Buf, this._type);

                for (int i = 0; i < elements; i++)
                {
                    ac[i] = mfis.ReadChar();
                }

                // skip padding
                if (this.padding > 0)
                {
                    this.Buf.ReadBytes(this.padding);
                }
                return(ac);
            }
示例#3
0
            /// <summary>
            /// Read MAT-file tag to a <c>int</c> array
            /// </summary>
            /// <returns><c>int[]</c></returns>
            public int[] ReadToIntArray()
            {
                // allocate memory for array elements
                int elements = this._size / this.SizeOf();

                int[] ai = new int[elements];

                MatFileInputStream mfis = new MatFileInputStream(this.Buf, this._type);

                for (int i = 0; i < elements; i++)
                {
                    ai[i] = mfis.ReadInt();
                }

                // skip padding
                if (this.padding > 0)
                {
                    this.Buf.ReadBytes(this.padding);
                }
                return(ai);
            }
示例#4
0
            /// <summary>
            /// Read MAT-file tag to a <c>double</c> array
            /// </summary>
            /// <returns><c>double[]</c></returns>
            public double[] ReadToDoubleArray()
            {
                // allocate memory for array elements
                int elements = this._size / this.SizeOf();

                double[] ad = new double[elements];

                MatFileInputStream mfis = new MatFileInputStream(this.Buf, this._type);

                for (int i = 0; i < elements; i++)
                {
                    ad[i] = mfis.ReadDouble();
                }

                // skip padding
                if (this.padding > 0)
                {
                    this.Buf.ReadBytes(this.padding);
                }
                return(ad);
            }