05-01-2013 12:25 PM
I have an array of 9 elements. One of the element is a timestamp. Each row requires a timesamp. I'm displaying the data on a matrix. I'm not sure if how I can display the timestamp, if I can at all. 7 of the elements are numbers. In the VI attached I used a random number generator to create these values but those values represent analog voltages that will be read from a DAQ device. The other element is a "User Input", which in the attached VI is a number but I would like it if I can have that as a text. I had the "User Input" as a text control before that is why I used the string functions in the VI but I run into the problem of displaying the text in the array (matrix).
I have attached the VI. Below is what I would like the table to look like. I used a matrix in the VI but anything that displays and the data will work.
User_Input Timestamp Value_1 Value_2 Value_3 Value_4 Value_5 Value_6 Value_7
TEXT TIME NUMER NUMER NUMER NUMER NUMER NUMER NUMER
Solved! Go to Solution.
05-01-2013 12:35 PM - edited 05-01-2013 12:37 PM
look at the string pallette, all kinds of goodies there including number/string conversion.vi's, while using build array....
05-01-2013 12:36 PM
An array will only hold elements of the same type, i.e. I32, U16, Dbl, text or timestamps. To mix different types you can use a "cluster", which is an element that can contain values of different types. Then your array can be an array of this type of cluster. If the "Value_x" you are showing may be of unknown length then you can have the cluster contain "Text", "Timestamp" and Array of "Value" elements, the cluster then being subsequently used in an array of these clusters.
05-01-2013 12:48 PM
I tried to build an cluster using the User Field, Timestamp and the numberic elements. I get an error when doing this saying that "The type of the source is 1-D array of double [64-bit real (~15 digit precision)]. The type of the sink is string." I have attached the VI. Can I just build a cluster using different types of elements?
05-01-2013 12:49 PM
@ashifulk wrote:
I have attached the VI.
????
05-01-2013 12:52 PM - edited 05-01-2013 12:53 PM
Sorry I thought I attached the VI.
05-01-2013 01:18 PM
05-01-2013 01:33 PM
What you want to do is create a cluster consisting of your string, timestamp and 7 values. Create an array of clusters that you can then iterate over and write to disk.
05-01-2013 01:42 PM
Thank you for the replies. I can write the data to a file but my question is about displaying it on the front panel. The cluster works but I do have a question. In my actual application I will have a "RUN" button that the user will press when they want to take data. What I need to do is write the data to a text file AND display it on the front panel. The display on the front panel should update the chart/matrix/cluster will new values everytime the user hits the "RUN" button. Is there a way I can do this using the cluster method? I need the display on the front panel to update with new rows while keeping the old rows. I attached a VI that I'm currently working on.
Below is how the program should work:
User hits "RUN" button --> Program takes 7 analog voltage measurements, creates a timestamp and saves the values along with the "USER INPUT" field to a text file and display the new values on the Front Panel. --> Program waits for the user to hit the "RUN" button or "STOP" button to stop the program.
05-02-2013 06:26 AM - edited 05-02-2013 06:29 AM
Good job trying to work this out. I can tell you are experimenting with the different functions.
Suggestions:
See my attached VI (LV 2012) . I use the same cluster, a While Loop, an Event Structure and a shift register to collect data from the operator using the Record button. When the Stop button is pressed, the same While loop I gave before converts the array of clusters to a string and writes the results to a file.