Reputation: 31
I have an array in VB with numbers. How can I save this in a txt file?
In R, for example, I do it like this: "write.matrix(A,file=name)". So the array with "name" is also stored in VB and I want to do the same thing here.
regards, daniel
Upvotes: 0
Views: 1494
Reputation: 460018
You could write it to a csv file, f.e. pipe delimited (because numbers can contain commas):
File.WriteAllText(filePath, String.Join("|", numbers))
You can load the array later in this way:
Dim split = From str In File.ReadAllText(filePath).Split("|"c)
Select Double.Parse(str)
Dim numbers As Double() = split.ToArray()
Upvotes: 1