Data storage and retrieval

It is possible to store ScalaLab arrays as text files. It is also possible to read these files. The file format is very simple. This also lets you create text containing data using any tool you want and load it into ScalaLab as data, as long as you follow the file format that is used, of course. There are two functions for doing this. They are called readAscii and saveAscii. The signatures of those functions are given here:

saveAscii(d: Array[Double], fileName: String): Unit
saveAscii(dd: Array[Array[Double]], fileName: String, sepChar: Char= ' '): Unit
readD1Ascii( fileName: String): Array[Double]
readD2Ascii(fileName: String): Array[Array[Double]]

The save function takes an array of doubles and a filename. The data will ...

Get Scientific Computing with Scala now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.