취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

Save a timestamp to a array

해결 완료!
솔루션으로 이동

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

0 포인트
1/10 메시지
10,498 조회수

look at the string pallette, all kinds of goodies there including number/string conversion.vi's, while using build array....

Example_VI.png

 

0 포인트
2/10 메시지
10,489 조회수

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.

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



3/10 메시지
10,486 조회수

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?

0 포인트
4/10 메시지
10,476 조회수

@ashifulk wrote:

 I have attached the VI.


 

????

 

0 포인트
5/10 메시지
10,473 조회수

Sorry I thought I attached the VI.

0 포인트
6/10 메시지
10,469 조회수

WriteToTable[1].png

0 포인트
7/10 메시지
10,453 조회수

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.

 

Save a timestamp to an array.png

0 포인트
8/10 메시지
10,443 조회수

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.

0 포인트
9/10 메시지
10,435 조회수
솔루션
주제 작성자 ashifulk이(가) 승인함

Good job trying to work this out. I can tell you are experimenting with the different functions.

 

Suggestions:

 

    1. Try not to use the sequence structure unless absolutely necessary. You will have problems as your code becomes more complex.
    2. For UI development, learn about the Event structure. Using a Boolean and a Wait next multiple consumes processor time.
    3. Learn about shift registers. These work along with the Event structure and While Loop to make for clean stand alone measurement VIs.

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.

 

 

 

 

 

10/10 메시지
10,413 조회수