/// <summary> /// Writes data to the hdf5 file. /// </summary> public void Write(short[,] data) { if (_nrOfRecords == 0) { Header.Recording.StartTime = DateTime.Now; var dataName = "Data"; dset = new ChunkedDataset <short>(dataName, _groupId, data); } else { dset.AppendDataset(data); } _sampleCount += (ulong)data.GetLongLength(0); _nrOfRecords++; }
/// <summary> /// Writes data to the hdf5 file. /// </summary> public void Write(IList <double[]> signals) { int cols = signals.Count(); if (cols == 0) { return; } int rows = signals[0].Length; if (rows == 0) { return; } double sr = _header.Recording.SampleRate; var data = new short[rows, cols]; //var byteLength = rows * sizeof(short); for (int i = 0; i < cols; i++) { var sig = signals[i]; for (int j = 0; j < rows; j++) { data[j, i] = convert2Short(sig[j], i); } } var dataName = string.Concat("/", _groupName, "/Data"); if (_nrOfRecords == 0) { _header.Recording.StartTime = DateTime.Now; Hdf5.CreateGroup(fileId, _groupName); dset = new ChunkedDataset <short>(dataName, fileId, data); } else { dset.AppendDataset(data); } _nrOfRecords++; }