Beispiel #1
0
 protected MatrixElement(MatlabClass matlabClass, IEnumerable <int> dimensions)
 {
     _matrixTag     = new MatrixTag(this);
     _classTag      = new ClassTag(matlabClass);
     _dimensions    = new ArrayDimensions(dimensions);
     _arrayName     = new ArrayName(string.Empty);
     HeaderElements = new List <IElement>(new IElement[] { _matrixTag, _classTag, _dimensions, _arrayName });
     _contents      = new List <IElement>();
 }
        public MatlabMatrix(IEnumerable <short> data, int[] dimensions, MatlabClass matlabClass = MatlabClass.MxDouble)
            : base(matlabClass, dimensions)
        {
            int product = dimensions.Aggregate(1, (current, dimension) => current * dimension);

            if (data.Count() != product)
            {
                throw new ArgumentException("Data must contain enough entries for all dimensions.");
            }

            Contents.Add(new ShortBuffer(data));
        }
Beispiel #3
0
 public ClassTag(MatlabClass matlabClass)
 {
     _matlabClass = matlabClass;
 }
 public MatlabMatrix(IEnumerable <ushort> data, MatlabClass matlabClass = MatlabClass.MxDouble)
     : this(data, new[] { 1, data.Count() }, matlabClass)
 {
 }
 public MatlabMatrix(IEnumerable <SByte> data, MatlabClass matlabClass = MatlabClass.MxInt8)
     : this(data, new[] { 1, data.Count() }, matlabClass)
 {
 }
 public MatlabMatrix(IEnumerable <float> data, MatlabClass matlabClass = MatlabClass.MxSingle)
     : this(data, new[] { 1, data.Count() }, matlabClass)
 {
 }
 public MatlabMatrix(IEnumerable <uint> data, MatlabClass matlabClass = MatlabClass.MxUint32)
     : this(data, new[] { 1, data.Count() }, matlabClass)
 {
 }