From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

appending array elements in array to spreadsheet string

Solved!
Go to solution

Hi all,

 

         What I am trying to do is writing my 1D array data into text file. Only one problem coming in my way is that it write only 10 elements array in file and I know that array dimension is 10, but what I want is to add every 10 element of array until I stop a loop by myself. Once again, I mean that I don't want 'array to spreadsheet string'  to re-write but want it to expand. (without changing array dimension). Any suggestions?

 

Thank you..

Download All
0 Kudos
Message 1 of 6
(2,676 Views)

I'm a little unsure about what you want to do here, from what I can gather you want to continue writing into the file continuously from the same ten element array until you stop it?

 

If that is the case then it should be a relatively simple matter of creating a for loop to write to the file buffer until you press a button and then exiting the for loop and flushing the buffer.

0 Kudos
Message 2 of 6
(2,654 Views)
Solution
Accepted by topic author AmnaG

Hi Amna,

 

please read the help for the WriteToTextFile function!

Especially the paragraph on the "file path" input! It contains two options to append new data to an existing file...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 6
(2,620 Views)

@GerdW

but before "write to text file" is a  "array to spreadsheet string" which is actually replacing 10 elements everytime and not allowing file to be appended.

 

@ogk.nz

 

yes I want continous writing to the file.

0 Kudos
Message 4 of 6
(2,595 Views)

Hi Amna,

 

- the "10 element limitation" is due to your ReshapeArray function.

- ArrayToSpreadsheetString is not involved when it comes to appending to or overwriting a file.

- All you need to change is with the WriteTextFile function - as explained before. Read the help!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 6
(2,585 Views)

Ok, so that shouldn't be too hard, if you want it to be writing a row at a time until you press stop. 

 

Could you save your examples for previous versions, I can;t access them to see what you have so far.

 

0 Kudos
Message 6 of 6
(2,572 Views)