Cant get array to work
I am probably doing something wrong. I am trying to build an array, store it in a file, and read it back. However, it seems to work but the data read back is incorrect!! so obviously it does not work please see the attached code and the associated expert data.
Yes...your use of FileWriteArray() and FileReadArray() is incorrect. FileWriteArray() and FileReadArray() should not be given dimension index (i.e., i and j); rather you must supply the starting point in the array and the count of elements you wish to write and read. So, if your variable is defined as NewArray[1, 17] and you want to write that array to a file, then:
FileWriteArray(AnalHandle, MyArray, 0, 17);
The above writes MyArray starting at index 0 for a count of 17 elements to the file defined by AnalHandle.
The same for FileReadArray():
FileReadArray(AnalHandle, NewMyArray, 0, 17);
The above reads 17 elements from file defined by AnalHandle and stores those elements in NewMyArray starting at index 0.
Yes...your use of FileWriteArray() and FileReadArray() is incorrect. FileWriteArray() and FileReadArray() should not be given dimension index (i.e., i and j); rather you must supply the starting point in the array and the count of elements you wish to write and read. So, if your variable is defined as NewArray[1, 17] and you want to write that array to a file, then:
The above writes MyArray starting at index 0 for a count of 17 elements to the file defined by AnalHandle.
The same for FileReadArray():
The above reads 17 elements from file defined by AnalHandle and stores those elements in NewMyArray starting at index 0.
OK. Thanks for that I have been chasing my tail round in circles for a couple of days trying to figure it out.
Starting AnalArray
sounds like a painful medical procedure ...
I am probably doing something wrong. I am trying to build an array, store it in a file, and read it back. However, it seems to work but the data read back is incorrect!! so obviously it does not work please see the attached code and the associated expert data.