SG++-Doxygen-Documentation
Using the DataVector object

This example shows how to initialize a DataVector object, store it to a file and then to restore it back.

1 from pysgpp import *

Create a vector with 3 elements

1 v = DataVector(3)
2 v.append(1.0)
3 v.append(2.0)
4 v.append(3.0)

Store the vector to file

1 print( v )
2 v.toFile("dataVectorTest.mat")

Load the created DataVector from file and then save it again (for no particular reason)

1 v2 = DataVector.fromFile("dataVectorTest.mat")
2 print( v2 )
3 
4 v2.toFile("dataVectorTest2.mat")