Jump to content

Saving and opening data from and too an array respectively


Recommended Posts

Hi everyone, I am trying to save the data that I have in an array into the file format as shown below. The input array only contains numbers on it but it is on a string format. The words and the writting that is shown in the attachment must be added to the file automatically.

Is there a way of doing so. The problem is not just writting into a file but also being able to load the data i.e. the numbers that are saved into the file and input that into a string array just as it was at the beggining before the array was saved into the file.

Would anyone ahve an idea of how to do around this problem at all.

the atached file can be opened using Notepad

thanks in advanced

Download File:post-4068-1162989372.txt

Link to comment

There are functions in the String palette to convert an array to a string and vice-versa, so that should take care of the array part.

To find the actual array when you read from the file you need to find the last semicolon and read what's after it. You can do this by searching the string in a loop (or reversing it and searching for the first occurence) or perhaps by converting the entire file to an array with a semicolon as the delimiter.

Link to comment
There are functions in the String palette to convert an array to a string and vice-versa, so that should take care of the array part.

To find the actual array when you read from the file you need to find the last semicolon and read what's after it. You can do this by searching the string in a loop (or reversing it and searching for the first occurence) or perhaps by converting the entire file to an array with a semicolon as the delimiter.

Thanks for the reply, but I'm actually using something known as "State Memory" to create the Arrays and finally I'm creating a 2D array from all of the results that I have and Saving it on users choice. I'm posting the example just incase someone else needs it.

Thanks again for your reply

Download File:post-4068-1163116683.zip

Link to comment

I fail to see how your second post has anything to do with the first, pther than that you have the two arrays there (and they're numeric arrays, not string).

If you still want to save and load to a file, then you just need to add a couple of states to your functional global which will go along the lines of what I previously suggested.

Incidentally, this type of global is quite common and has many names - "USR global", "LV2-style global", "Action engine", "Functional global (FGV)", etc. Hopefully, it's known by all LAVA members who have been using LV for any length of time.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.