LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File I/O problems

I have an array of clusters with a string and array in each.

Array(128)--
                   |
                   Cluster
                              |
                              -String
                              -Array(7)

The string is from a listbox and I don't know what the length will be.
The Array is an array of Singles.

I wish to save this to a file so that is can be loaded upon next boot.
I tried to save as binary IO and it did save but I couldn't load it back in ( it would be nice to see what it did load so I can see where I went wrong) but all I got was an erro 116 (Unflatten or byte stream read operation failed due to corrupt, unexpected, or truncated data.)

Then after reading a bit more it loked like I could use Datalog read and write but the terminal would not accept my data.

Can anyone suggest to me the proper way to save this data for future retrieval.

Ron
0 Kudos
Message 1 of 5
(2,931 Views)

Hi

You best can save all to a textfile. the array of sib=gles first and the straing on the same line afterwards.

for the array I would use array to spreadsheet string and remove the attached crlf or cr or lf depending on your programming platform.

than concat a tab and the string  and place the crlf or lf or cr after the string, you could also use search and replace string 

do this for all your arrays in an autoindexing for loop and concat the resulting string array to a string and write that to a textfile.

the example in lv7.1.1 shows part of the solution

greetings from the Netherlands
0 Kudos
Message 2 of 5
(2,927 Views)
This can be done very simply by using Flatten To String and Write Characters To File, then use Read Characters From File and Unflatten From String.  See attached vi.
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 5
(2,920 Views)
Thanks for the help guys!

I did manage to get the file to load with the datalog control except the array come in as the wrong size.

My array should be 128x7 yet it loads in at 128x128. if I alter the loop count then it changes the first dimension and the second stays at 128.

 I've attached the portion of my VI to show you. How can I get it to load in correctly?

Ron
0 Kudos
Message 4 of 5
(2,898 Views)

Can you post the ini file that you are using. I need to have this to see the issue you are seeing. From my guess though it would have to be the way you are inputing the array, maybe you have the dimension backwards. Try transposing it.

Tyler H.
National Instruments

0 Kudos
Message 5 of 5
(2,872 Views)