LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Initialization of table of cluster of two elements

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

0 Kudos
Message 1 of 11
(727 Views)

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").

0 Kudos
Message 2 of 11
(698 Views)

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).

 

 

0 Kudos
Message 3 of 11
(691 Views)

So, how does the file look like? Can you attach a typical file?

0 Kudos
Message 4 of 11
(671 Views)

See if this draft can give you some ideas.

 

 

 

0 Kudos
Message 5 of 11
(666 Views)

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 !

0 Kudos
Message 6 of 11
(639 Views)

I just checked what you sent, can you please explain me the shift register with the timeout ?

0 Kudos
Message 7 of 11
(637 Views)

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.

0 Kudos
Message 8 of 11
(629 Views)

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

 

 

0 Kudos
Message 9 of 11
(602 Views)

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.

 

altenbach_0-1710440143942.png

 

 

 

The array with two columns can be converted back to a spreadsheet string using "|" as column delimiter. Try it!

Message 10 of 11
(587 Views)