In my application ,i have an array that i have to write to text file.so before writing to text file,am converting the array to spread sheet format,
using array to spread sheet conversion.
The array i am converting is a 2D array.Suppose the array contains 6 elements. as follows
What i have to do is,have to delete the first element from the array and convert to spread sheet string and then to write to the text file.
The result of array to spread sheet conversion is correct..it resu,lt me as follows..which is correct...
But after writing to text file,the only thing being written is the following
All other data lost....I cudnt find where am going wrong...
Pls guide me on this.
Am attaching a sample code as attachment...
Thanks in advance
this is because, whenever you are opening the file, index will be 0.. & then you write anything, it will overwrite the previous data ...
For your requirement, you have to use "Write to Spreadsheet String.vi".. please see the attachment.
First close the connection after writing to file, then open the new connection and read the file.
Hope this helps
Thanks for ur reply.
I cud only find write to spreadsheet file.vi...and using that cant input 2d array of string.
I was unable to locate write to spreadsheetstring.vi..I am using labview 8.0.
Am attaching my code after changing...
Please guide me on this.
I need not read & close the ref ... just create the file first .. & then keep on appending the data to it .. If you can upload the VI, it would be easy for me..
To my understanding, Write to Spreadsheet.vi in LabVIEW 8.0 can only write 1D/2D Numeric Array. Hence, you may want to consider using Array to Spreadsheet method again.
Let me summarise your problem. Your problem is when you read back from your read (as shown in array to spreadsheet.jpg), you only manage to read 1 element in your array. The rest of the 6-7 elements are missing. Please correct me if I am wrong.
The reason to your problem is because of the write to file pointer. For the 1st time, you write 8 elements (there is 8 rows in your 1st 2D array in your post). The 2nd time, you write 7 elements (7 rows in your 2nd 2D array). Because you use 'open', the 2nd time you write will replace row1-7 data in your text file. The pointer now rest at the end of row 7. So when you read after that, you will read row 8 (which is element 8 in your 1st 2D array).
To solve your problem, you should modify your vi to something similar to the picture attached below. This will reset the pointer to the start of the file before reading the data in the file. By doing this way, you will read all the datas in the file.
This problem do not occurs if you only open, read and close file (not open, write, read, close file). The pointer is reset to the start of the file when you use Open File function.
Hope this solve your problem.
I cud fix the thing by changing theVI," Write to Spreadsheet file.vi" according to my need.Thanks for all helps!!!!