/// <summary> /// read data from file, data will be transposed back to original format /// </summary> /// <param name="file_name"></param> /// <returns></returns> public static double[,] read_file(string file_name) { int[] num_elements = new int[1]; int res = DataHandlerLibrary.get_num_elements_in_file(file_name, num_elements); if (res != (int)CustomExitCodes.STATUS_OK) { throw new BrainFlowException(res); } double[] data_arr = new double[num_elements[0]]; int[] num_rows = new int[1]; int[] num_cols = new int[1]; res = DataHandlerLibrary.read_file(data_arr, num_rows, num_cols, file_name, num_elements[0]); if (res != (int)CustomExitCodes.STATUS_OK) { throw new BrainFlowException(res); } double[,] result = new double[num_rows[0], num_cols[0]]; for (int i = 0; i < num_rows[0]; i++) { for (int j = 0; j < num_cols[0]; j++) { result[i, j] = data_arr[i * num_cols[0] + j]; } } return(result); }