File I/OΒΆ

File I/O operations are available for use on the host PU and during simulation.


Methods

def loadCSV1D[T:Type](filename: String, delimiter: String)(implicit cast: Cast[String,T]): Array[T]
Loads the CSV at filename as an Array using the supplied delimiter for parsing.
The delimiter defaults to a comma if none is supplied.
def loadCSV2D[T:Type](filename: String, delimiter: String)(implicit cast: Cast[String,T]): Matrix[T]
Loads the CSV at filename as a Matrix, using the supplied element delimiter and linebreaks across rows.
def writeCSV1D[T:Type](array: Array[T], filename: String, delimiter: String): Unit
Writes the given Array to the file at filename using the given delimiter.
If no delimiter is given, defaults to comma.
def writeCSV2D[T:Type](matrix: Matrix[T], filename: String, delimiter: String): Unit
Writes the given Matrix to the file at filename using the given element delimiter.
If no element delimiter is given, defaults to comma.

Under development

The following methods are not yet fully supported. If you need support for these methods, please contact the Spatial group.

def loadBinary[T:Type:Num](filename: String): Array[T]
Loads the given binary file at filename as an Array.
def writeBinary[T:Type:Num](array: Array[T], filename: String): Unit
Saves the given Array to disk as a binary file at filename.