03-13-2024 05:23 PM
Hello everyone !
I am working on a project. I wanted to know if someone knows how to initialize a table of cluster of two elements (i am joining a picture of the table I want to initialize). I try to use the function already included in Labview 2013 but since it's not a classic table, it doesn't work.
Would someone have a lead on that matter ?
Thank you for any help you can give me.
Have a nice evening
03-13-2024 06:19 PM
Create that cluster elements then use "initialize array" with that cluster and desired size. Use code to fill it with values and create an indicator for it. (this has nothing to do with a "table").
03-13-2024 06:27 PM
Thank you for your answer !
I don't really understand how to apply this, because i don't know the size of my cluster until it appears (I am joining the VI).
I was looking to initialize my cluster because when it opens a file, the cluster before the opening is still there and the new medications/time is added instead of being a new cluster (I don't know if I am very clear, tell me if I'm not).
03-13-2024 06:52 PM
So, how does the file look like? Can you attach a typical file?
03-13-2024 07:16 PM
03-13-2024 10:28 PM
Sorry, I forgot to attach a typical file. I am joining it. The files will all have the same format :
Time|Medication then line break for each Time/Medication pair.
And thanks, I will check what you sent me !
03-13-2024 10:33 PM
I just checked what you sent, can you please explain me the shift register with the timeout ?
03-13-2024 11:17 PM
It runs the timeout event once when the program starts (timeout=0). After that, the timeout is infinite (-1). In the timeout event we read the file.
Of course the program needs more functionality, e.g. to read a new file or save the modified file, add new entries, remove entries, etc.
I would also arrange the cluster elements side by side and grow the array vertically., arrange the controls better, etc.
03-14-2024 05:43 AM
Thanks for the answer !
May I ask why do you use a for structure to convert a table in a cluster ? And how you get back a table in the end ?
Thank you
03-14-2024 12:31 PM - edited 03-14-2024 01:16 PM
You simply need to start with a few basic tutorials!
Also make sure you use the correct terminology. The "file" data is just a single very long string with fields delimited by row delimiters ("<linefeed>)and column delimiters ("|") in your case. This is converted to a 2D array of strings, not a table (but you could use a table indicator to display it, of course).
We use a FOR loop to process each row of two elements into a cluster of two elements. Autoindexing at the right border gives us a 1D array of clusters. Just follow the wire and use the context help on anything you don't recognize. Also note that "Array to cluster" requires setting the cluster size, "2" in this case.
To go back to an array with two columns, we would auto-index on the array of clusters, convert each into a 1D row, and it back into a 2D array at the output tunnel. One row per cluster.
The array with two columns can be converted back to a spreadsheet string using "|" as column delimiter. Try it!