LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

creating array

Nxt is sending a series of string like " A, B, C, D" one by one. I programmed to view those string on the front pannel but I want to save these string as array of data. Then I want to save those data in a text format. Which I should be able to view at anytime. Also the saved file should have all the strings send by nxt.

0 Kudos
Message 1 of 6
(2,633 Views)

I think we can help you.

 

can you post what you have now so we have a starting point?

0 Kudos
Message 2 of 6
(2,620 Views)

When I run this program I am seeing the string in the message box on the front panel but I want to save all those strings in a file.

0 Kudos
Message 3 of 6
(2,600 Views)

Ah, I see.  You almost had it.  The problem is that you are over-writing the entire text file in each iteration, so your text file only shows the most recent message.

 

To prevent over-write, you need to do two things (1) address the file by a Refnum (not a filename) and (2) set the file position to 'end' before writing.  This will cause the new data to be appended to the end of the file.

 

To generate the Refnum, use the File Open Vi.

 

In this example, I'm using a random number generator to create the message and then writing it to the end of a file.  In your program, you can just replace the random numer with your output message.

 

 

0 Kudos
Message 4 of 6
(2,594 Views)

In this version, I've added a shift register and "build array" function so that you can see all of the messages in an array while the loop is running.

0 Kudos
Message 5 of 6
(2,591 Views)

Thank you somuch. This really works. I was trying somany things for the past few days but I couldnt do it. And you saved me. Thx..

0 Kudos
Message 6 of 6
(2,589 Views)