LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving 2D array for 16 Channels

Hi

I am having trouble saving my 2D data to a spread sheet file? I do not know what I am doing wrong?

I am using an Advantech PCI-1713 card. There is an example VI that I am using that came from Advantech. I am just trying to get my data to save and it is not doing it. I am new to labVIEW so I think it a mistake that I am doing but can't realise it.

If anybody has a chance please have a look at the VI I have attached and the typical results I get.

Thankyou

Cheers

lp19
Download All
0 Kudos
Message 1 of 7
(3,264 Views)
It's not clear to me what your problem is. Are you having problems with the Advantech stuff or saving to file? The fact that you've posted an Excel file with data makes me think that the saving part is working - it's just that you've got bad data. If it's bad data, you might want to check with Advantech support to see if you're using the correct functions and parameters.
0 Kudos
Message 2 of 7
(3,264 Views)
Hi Dennis,

Thankyou for your interest.

My problem is definately saving the data and writing it to file. The Advantech VI works well. I do not know if you have used or using Advantech Hardware and using a driver to interface with LabVIEW so i do not know if the Advantech VIs will appear when you open up the VI I attached to my original posting.

But if you do Advantech have made these sample VIs for multi channel DAQ and in them they have controls such as COUNT CYCLE MODE, SAMPLE RATE, FIFO SIZE etc. As you are well aware of.

"COUNT" means "the number of data set".
For example, if you use "non cyclic mode" and "count=100", you will get 100 set of data after you start the data acquisition.
If you use "cyclic mode" and "count=100", you will get 100 s
et of data at every one cycle of data acquisition.

The problem is that I only get one cycle of data written to my spreadsheet when I use CYCLIC mode, when really i should be getting more. That is what the excel spreadsheet was supposed to illustrate. I think I was very unclear about that. The data in the actual spread sheet is not relevant. Its the fact that I only get one cycle worth of data written to my spreadsheet file when I use Cyclic mode, that is my problem.

So that is why I think the problem is in my LabVIEW programming skills because i am new to it and do not fully understand the environment completely. The adavntech stuff is working fine.

I just cannot figure out why i am only getting one set of data written to my spread sheet when I should be getting lots more.

Cheers

lp19
0 Kudos
Message 3 of 7
(3,264 Views)
I looked at your code and it looks like you are writing only the last acquired value to file. I cannot say for certain though because I am missing a lot of VIs. I recommend (for troubleshooting) changing the tunnel (orange square) to be auto indexed (right click on it) and then displaying the data in a 3 d array. This way you can verify the when what data is sent out. If this turns out to be the case, there are several examples for building arrays of data we can show you.
0 Kudos
Message 4 of 7
(3,264 Views)
Hi Jeremy,

Thanks for taking an interest in my problem.

Your recommendation was very good, what I did was at the border
(on the right hand side) of the bottom of the Case Structure, for the true case I created an Indicator and for the False side I created a constant. Then I wired the indicator to the border of the While Loop and Enabled Indexing and then created another Indicator (Output Array 2) to show me what is happening to the data.

I read the information about Auto Indexing from the help file but I am confused as to what it is actually doing? Could you maybe explain it in simpler terms?

The result of the modification is that your original theory is correct. The data is being acquired fine by the ADVANTECH program but
it is not getting out of the while loop. The data only gets sent to the second output array when you stop the VI running.

So that means that only the last set of data is being sent out to the excel file and the rest I have not a clue as to where they are??

How can I over come this problem, how can I get the data out of the While Loop, what tutorials should I be looking at?

I have attached what I have done, in case my explanation is unclear.

Cheers mate

lp19
0 Kudos
Message 5 of 7
(3,264 Views)
I cannot get your VI to open. There may have been some corruption on the database.

Auto indexing is an easy way to build data into arrays or to index arrays when using loops. For instance if you feed a 1d array into a for loop and auto index it, it will iterate the number of times as there are elements on the array. Also the wire (now thinner) will have subesquent elements of the array for every iteration.

To address what you are doing (ie building an array with autoindexing), labview can take data that is wired to the edge of a loop from the inside and build it into the array. It is easy to do and is fairly efficient. Try wiring i to the edge to see this in action.

LabVIEW can auto index larger dim arrays
(5d becomes 4d) and build smaller arrays into larger arrays (3d to 4d).

To make one large array for your data from every iteration of the loop, you need to use a shift register (right click on the edge of the loop) for holding the array for every iteration. Wire from the left shift register to the upper terminal of a two terminal build array function. The output should be wired to the right shift register. To the bottom terminal, wire your data. You may need to right click on the build array and choose to concatenate the arrays to prevent the dimensions from increasing. You may also have to experiment with the order of the wiring too. There is a shipping example that show how to do this. Open LabVIEW 7 >> help >> find examples >> fundamentals >> arrays and clusters >> Separate Array Values.vi . Most of the examples in the folder address autoindexing if you would like more examples for that.

What version of LabVIEW are you using?
0 Kudos
Message 6 of 7
(3,264 Views)
Hi Jeremy,

Thankyou for your continued interest.

I actually figured out how to save my points into a file but I am not sure if it is the most effective way of saving continuous data into a file. When I run the program everything seems to run ok. It works! I have included the VI and would like to know what you think of my attempt. if you have any suggestions on how I can make it more efficient I would like to know. I know that the advantech VIs will not open when you open the file but everything else should be fine.

I also followed what you told me in you last comment and included that VI to titled 'your way'
This method works well too when I run the program but the oputput is a 3D array and I do not kn
ow how to deal with this type of array.

I am using LabVIEW 6i to awnser your question.

Once again thankyou for all your help and would like to know your opinion on what I have done.

Cheers

lp19
Download All
0 Kudos
Message 7 of 7
(3,264 Views)