LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Headers for Write to Measurement File

I fixed the issue I wass having with DAQmx, but now when I run the VI, it makes me save files continuously. Any idea on what is going on there? I would like all the data go to one file. 

Thanks for all the help!

0 Kudos
Message 11 of 21
(2,330 Views)

You're still not doing what I suggested.  Convert BOTH of the DAQ Assistants to standard code, and remove all the dynamic data functions.  Trust me on this.  Put DAQmx Read inside the loop (otherwise you're only getting a single reading, once, before the loop starts), connecting the DAQmx Task wire from the initialization VI (outside the loop on the left) to the Read (inside the loop) and from there to the Clear Task (outside the loop on the right).

 

As for the file saving, what you want to do is create the file and write the header outside the loop, so it only happens once.  Store the file reference in a shift register and write the data to it on each loop iteration.  On the other side, after the loop terminates, close the file.

0 Kudos
Message 12 of 21
(2,327 Views)

I have made some modifications to the VI. I am encountering the following problems.

I would like to go form the merged 2D DBL array to taking the mean and splitting up the channels, but I cannot get around having the "select signals" operation.

Second, I am attempting to write the file with Open/Create/Replace File, but I do not know how to store the file reference in a shift register, I am also trying to figure out how to go from "format into file" to "write to file".

 

Thank you for your help

0 Kudos
Message 13 of 21
(2,303 Views)

The file reference does not need to be in a shift register, it's fine in being passed through tunnels the way you have it.


See attached.  I'm not sure if it's exactly what you're aiming for, but I think it's the right direction.  The transpose array functions may not be necessary - I never remember how data from DAQmx Read is arranged.  I can't figure out why you were trying to write just the hour of the day to the file, so I left that orphaned.

 

Please clean up your VI.  There are wires going all over the place with excessive bends and huge amounts of open space that make it difficult to move around the block diagram.  Wires should run from left to right with as few bends as possible and should not overlap other wires or objects.

0 Kudos
Message 14 of 21
(2,297 Views)

I am not at my labview computer right now, so I have not taken a look at the VI. I wanted to have time stamp data for each data point. I thought I was doing this correctly. Do you have any suggestions on how to do this better? 

0 Kudos
Message 15 of 21
(2,291 Views)

@aem64 wrote:

I am not at my labview computer right now, so I have not taken a look at the VI. I wanted to have time stamp data for each data point. I thought I was doing this correctly. Do you have any suggestions on how to do this better? 


You had the right idea, but you didn't put a column header for "timestamp" so all your column headers would have been off, and you used "%H" as the format string which would return only the hour of the day.  Figure out the right format string for the timestamp as you want it displayed, append a delimiter ("," in your case), and then put that string at the beginning of the data string using concatenate strings.

0 Kudos
Message 16 of 21
(2,289 Views)

I get an output that does what I want in terms of the headers to the columns, but I am having trouble lining up the data I think.

The data seems to be offset. I have included an example of what the front panel is, and what the data shows up to be. Two columns of data seem to be missing.

 

The data also seems to be missing values smaller than 1, no decimals show up.  Is this information lost when converted to a spreadsheet?

 

0 Kudos
Message 17 of 21
(2,274 Views)

I only see one column of missing data when I open the file in Excel.  Also, I doubt that the file that you attached was produced by the code you attached, since the code uses "," as a separator but the file is tab-delimited.  One reason you may be off is you're putting the first column of data into the same field as the timestamp.  Insert a delimiter (a comma in your case) between the timestamp and the spreadsheet string.  If you're still off after fixing that, you'll need to trace the wires to determine which data is in which column and find where they don't line up.

 

Why are you transposing one of the two arrays of DAQmx data, but not the other one?  I do not know whether or not the transpose array is necessary - as I mentioned, I don't know off-hand whether channels are in columns or rows - but either both sets of data should be transposed, or neither should.

 

The reason you're not getting decimals is that the format string you're using, "%d," formats a value as an integer.  Try using "%f" (or "%.3f" to limit to three numbers after the decimal place).  The format string is an input to Array to Spreadsheet String.  See the help for details on format string syntax.

 

There are still a couple of odd bends in wires but it looks a lot better and I hope the results are closer to what you're trying to achieve.

0 Kudos
Message 18 of 21
(2,268 Views)

I think the data got screwed up because I saved over it after opening it in excel. The reason only the voltage signal is transposed is because that is the only case in which the data that comes out makes any sense.

 

I am having a problem with the DAQmx read. I had to update to include two more channels (one for flow, and another for vibration). I updated the Current DAQ task in measurement and automation, yet I do not see the DAQmx read updating. When I run the VI, I get a signal, but the sub VI is not updating. 

Do you have any idea what this could be?  Can I only create the DAQmx once?

Download All
0 Kudos
Message 19 of 21
(2,257 Views)

I just realized that you are correct in regards to the transposed data coming in. I think the error had to do with the fact that the calibrations constants are off. With the transposed matrices, I get all the values as the same number, when they are not transposed, I have data, but obviously it is wrong, which makes me believe that something is wrong with the calibration.

 

The only reason I thought that the data was correct with one array transposed was because temperature was coming out correctly (70 degrees).

 

0 Kudos
Message 20 of 21
(2,254 Views)