LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

storing comments into file, newbie at this stuff

i am a new beginner in using the software.

 

i am having a small problem. hope someone can help out. so i have a while loop and inside the loop i have the "write to measurement file" function in. into the signals part goes in a combine set of signals. however all the signals are numberical data. i am trying to add comments in the form of text after this data to describe what the data means.

 

of course, i can't or don't know how to merge the string control signal with the other numberical data signals together so i have tried the option of just linking the string indicator with the comments part. 

 

the thing is that while the program is running within the while loop, i want to type in some comments/text and when i hit the return key after done typing, the string/text i typed will be transferred to the file, the indicator would then be refreshed, go blank, stay  blank, and wait until i decide to type in more comments somwhere later down the line while the program is still running within the while loop.

 

i have gotten some feed back saying that i should use the "scan to string" function but i have no idea how to use it. the thing is that i don't know how labview can recognize when a user types in the return key.

 

my thought is that i can somehow scan the string i am typing in, and when it recognizes that the last character i typed is the return key, it can then stop, wipe off the typed text but it doesn't have to be wiped off, and wait for more text later down the line.

 

and another thing. why is it that when i use the string length function for a string, it somethimes goes crazy and gives me a value that is less or more than what it should, like if i type in "hat", it would give me 2, not 3? 

0 Kudos
Message 1 of 13
(3,382 Views)
any insights?
0 Kudos
Message 2 of 13
(3,371 Views)

Why did you create a new login name and post under that?

 

Perhaps you should continue in this thread because you are already receiving assistance there on similar questions on the same VI.

0 Kudos
Message 3 of 13
(3,361 Views)

The basic layout of your application then could be the following:

 

1. Have the DAQ assistant collect data and write it to the Write to Meas File VI (all in a while loop)

2. You can then have a string control wired to the "comment" input of the same VI

3. When the VI is run, at every iteration  of the loop, Labview write whatever's in the string to the Comment part of the file. However, when you type something in, you need to either click outside of the string control for it to register, or press the NumPad enter key (you can use the regular return key if you set that key to mean the end of text entry in Tools > Options > Environment )

4. However, this will now write that string to file continuously, whereas you want this to happen only once (right?). In this case, you'll have to use an event structure to watch for the return key (use the Keydown event and watch for "char" being 0). Then you should be able to reset your  string control to the empty string.

Misha
0 Kudos
Message 4 of 13
(3,328 Views)

i am looking over a document on how to use an event structure right now. i haven't been programming very long

 

what do you mean when you say "use the Keydown event and watch for char being 0"?

 what is "keydown event"?

can you be more specific when you say that i can reset my string control to an empty string? i am under the impression that any type of control in labview can't be changed by the software being run. what i mean is that to clear a string/text typed in, the user has to go in and manual backspace the text away.

 

how would i tell a string control (which has info flowing out of it) to  make any type of change in it?

 

one can't actually give a control any inputs/commands (link a wire to the control as an input) to tell the control to change what is inside.

0 Kudos
Message 5 of 13
(3,318 Views)

The simplest thing to do is break it up into 2 parts:

1) Write the comments to the file

2) Write the data to the file

 

Now you can choose whether you want to write the data or comments first based on the order,

but basically heres all you have to do:

 

What I showed will add the comments at the end.

This way, you can add comments while collecting data, then the comments will append to the end of the file.

If you want the comments to be written before data is collected, you just move that step in front of the loop.

Just make sure that the comment writing is OUTSIDE of the loop.

Message Edited by Cory K on 02-12-2009 06:12 PM
Cory K
0 Kudos
Message 6 of 13
(3,313 Views)

nadda wrote:

...  i want to type in some comments/text and when i hit the return key after done typing, the string/text i typed will be transferred to the file...


Why would you want to do that? Then your comments will just be all mixed in with your data.
I would strongly recommend putting the comments all in the beginning or all at the end.

Cory K
0 Kudos
Message 7 of 13
(3,310 Views)

You can use event structures to capture user input events. Please take a look at the "Event tracking.VI" example. It should clarify some of your questions.

Also, it is possible in Labview to change the value of a control by making a local variable for that control (right-click > create > local variable) and then writing/reading a value for that control. 

 

Cory makes a good point though, why do you want to leave comments in the middle of your acquisition and mix these with your data?

Message Edited by mishkin on 02-13-2009 09:25 AM
Misha
0 Kudos
Message 8 of 13
(3,292 Views)

the reason why i want to mix the comments with the data is this.

 

as labview is continuously running in the while loop collecting data and writing it to a file, the file where the data is collected also creates time stamps. the setup which i am collecting the data from can have sudden problems and issues. since i am watching the setup or equipment running, i would like to type in any issues i see and that comment will be made at the time stamp/time which i saw the problem. 

 

so as i turn on my equipment and let the software run, i want to to type in something like "started collecting data". in the middle of the experiment, let's say that the equipment makes a glitch. i can just type in "the voltage or pressue went up". afterwards, i can look at the comments and see at what time they were made and go from there to make any data analysis.

0 Kudos
Message 9 of 13
(3,277 Views)
I would recommend turning your arrays into strings before hand, and append at the end of each row another column of data that is generally blank, but occasionally puts in the comment text.  That way if you import into excel, all your data is still in rows and columns not intermixed with text data, but the text data is right there on the write next to its data point of interest in the new column.
Message 10 of 13
(3,274 Views)