private bool getOMXMatrixTables() { // get info about the tables this.dataGroup = H5G.open(fileId, dataGroupName); this.NumMatrix = (int)H5G.getNumObjects(this.dataGroup); this.MatrixNames = new List <string>(); for (int i = 0; i < NumMatrix; i++) { string matName = H5G.getObjectNameByIndex(this.dataGroup, (ulong)i); MatrixNames.Add(matName); H5DataSetId matId = H5D.open(dataGroup, matName); tables.Add(matName, matId); } return(true); }
// Matrix Specific Methods // TODO: // 1. add handling for matrix title // 2. add specification of NA values // 3. other attributes: pa-format flag, year int, source string /// <summary> /// Add a matrix table to an opened OMX file /// </summary> /// <param name="matName"></param> /// <param name="matDataType"></param> /// <returns></returns> public int AddMatrix(string matName, H5DataTypeId matDataType) { int status = -1; // check that matrix doesn't already exist if (!tables.ContainsKey(matName)) { H5DataSpaceId matSpace = H5S.create_simple(2, Shape); H5DataSetId matId = H5D.create(dataGroup, matName, matDataType, matSpace); tables.Add(matName, matId); H5S.close(matSpace); MatrixNames.Add(matName); NumMatrix++; status = 0; } else { this.ErrMessage = string.Format("matrix {0} already exists", matName); } return(status); }