From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing and Plotting Data from a Measurement File

I don't know if you remember, but I mentioned this problem before. in reply #31 http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=412736#M412736 

 

 

You have an array of 13 booleans, but you only have an array of 12 filenames.  (For some reason, the 13th LED associated with valve 9 is unnamed)!!??

 

If the 13th item is the true item, it will get a default empty filename out of the array, and thus force a dialog box asking for the filename.

0 Kudos
Message 41 of 52
(853 Views)
Okay, I've added the 13 file name, but that doesn't change anything. The same thing still happens.  This happens at the start of the program. So, it shouldn't try to write data tp the 13th file.  I'm not sure where the 13th LED associated with valve 9 is unnamed that you are talking about, because the valve LED's that light up to show which valve is turned on is a Type Def. I've doubled checked the indicators that light up to tell you when each file is being written too.  Which loop is this unamed LED in?
0 Kudos
Message 42 of 52
(850 Views)

After the top state machine.  I named it "asdasd" to show up a bit better.  It comes out of the And that comes out of Valve9.  I tried to find it on the front panel, but it seemed like the entire tab control highlighted.

 

Drop a few probes here or there on your block diagram,  perhaps some breakpoints, or highlight execution.  See if you can figure out exactly which part of your code is triggering the extra dialog.

Message Edited by Ravens Fan on 06-11-2009 05:28 PM
0 Kudos
Message 43 of 52
(844 Views)

I think I know what is causing it.

 

Do you ever have a case where no valves are open, booleans are true?  If a true can't be found in the boolean array, then the Search 1-D array function returns a -1 as the index.  Put a -1 index into an array, you will get the array's default data type, which for a file path array would be an empty file path.

 

If you wrap the write to spreadsheet file in a case statement, wired from the index, put the file VI inthe default,0 case.  Make a -1 one case and leave it empty, then the write to spreadsheet file won't execute when the index is -1 and the file path is empty.  (You could also use the Not a Path function on the comparison palette and just make your case structure a True/False).

Message 44 of 52
(831 Views)

That did the trick to get rid of that problem, but only the time and data stamps for each of the channels is getting logged and not the the measured data. What could be the cause of this? I've attached the txt file below. Also, how can I just put one date stamp and one time stamp into the file? The FOR loop retrieves the data stamp and the time stamps for each channel separately so they can be put into separate columns. However, I only need one time stamp and date stamp for each row of samples. Finally, I am still receiving that Error 0. I have not noticed any other error with the operation of the system besides the data written to the file incorrectly. Do you notice anything that could cause this?

 

Thanks! 

Download All
0 Kudos
Message 45 of 52
(826 Views)

You have a For loop to the lower left creating an array of dates and an array of times.  One for each waveform in the waveform array.  But this will iterate so quickly, all the dates and times should be the same and would have no real correlation to when the data was actually collection.  I would eliminate the For Loop and just use Index Array to get the dt and T0 of the first waveform.

 

The reason for no real data is this.  You are taking your array of data and doing a reshape array on it for a length of zero.  So you are taking your array and turning it into an empty array.  So not data comes through.  I don't know why you would be using Reshape Array.  It seems to me you should be using Index Array.

Message 46 of 52
(822 Views)
That did the trick! Now, is there a way to add titles for the tops of each column in the data file?
0 Kudos
Message 47 of 52
(818 Views)

Sure,

 

You just need to use the same function to write a header string to the file, but only the first time you open it.  Easiest thing would be to just take your array of filenames and open each one, write the header, at the very beginning of the program.

0 Kudos
Message 48 of 52
(815 Views)

Okay, I've been running my program for the last day to check for stability and performance. Right now it is just reading in 3 RTDs and there is nothing connected to the CO2 and flow.  The data file looks good for the most part. However, every now and then two data points are written in the same cell. I looked at the data file to try to figure out a pattern when this was happening, but I don't see a reoccuring pattern.  What could cause multiple data points to be written in one cell and how can this be corrected? I've posted a portion of the data file where this occurs.

 

Nevermind the time stamp. The first two numbers are the cycle number, and when I posted it here it combined those two cells together.

 

 

71 24/15/2009  19:24:23.765 24.683122 24.771832 25.250652 0.026825 -0.013893
71 24/15/2009  19:24:23.965 24.683122 24.771832 25.250652 0.027144 -0.014524
71 24/15/2009  19:24:24.165 24.68343024.683430 24.77306224.773062 25.25003725.250037 0.0268250.026188 -0.026522
71 24/15/2009  19:24:24.565 24.68343 24.773062 25.250037 0.026188 -0.014524

 

0 Kudos
Message 49 of 52
(794 Views)

Hello NT_Engine,

 

I noticed that you are using Write Character to File VI which is no longer supported by LabVIEW. Have you tried using Write to Text File VI instead?

Andy Chang
National Instruments
LabVIEW Control Design and Simulation
0 Kudos
Message 50 of 52
(785 Views)