LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save and load array of string

Solved!
Go to solution

Hi,

is possible save to file array of string with multiple line text and load it back from file to array with same size of array?

Because when I use code on picture, initialized array is 3x3 but after save and load from file is array 5x3.

SaveAndLoad.PNGSaveAndLoad2.PNG

So is any option how save this array to file as 3x3 array and load back from file as 3x3 array?

Thank your for any suggestion,

Petr

0 Kudos
Message 1 of 3
(2,981 Views)
Solution
Accepted by topic author Vávra

The reason your code is loaded back in at 5x3 is because two of your cells have Line Feed (\n) characters. The Read from Spreadsheet VI uses any Return or Line Feed characters and your delimiter to figure out how to split the string in to an array.

A workaround could be to replace all End of Line characters with something else and then re-insert after read from spreadsheet.


This can do what you want even though it is a little bulky. It's a little confusing if you don't understand "\" string formatting, but it essntially replaces all "\r" and "\n" with "\\r" and "\\n", whcih the spreadsheet conversion doesn't read as an End of Line character.

Example_VI.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 2 of 3
(2,945 Views)

Thank you very much.

Its exactly what I want.

You are the best James Smiley Wink

0 Kudos
Message 3 of 3
(2,920 Views)