LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

splitting an array

Hi guys,

 

I am trying to modify a program at work with LabVIEW, but I am only a beginner at it so I am having a few problems. Basically, it is a data acquisition program that gets it data from accelerometors. The data is read using the AI read function, output to an array and then plotted onto a waveform chart. I am trying to modify the program so that the data gets plotted on three seperate charts instead of one, becuase it was very hard to read before, with 25 channels on it. I thought I could do this by using an "array subset" function to split the 25 channels into 5,15,5 channels onto three seperate charts. For some reason this isn't really working too well, and I'm not really sure how to try and debug it. I have a background in C and MatLab and I know how to use those debuggers, but I am definitely struggling with LabVIEW. Could anyone tell me why my program isn't working or at least help me debug it somehow.

 

I have attached the program. The modifications that I have made are in the top right corner - the addition of the three "array subset" functions.

0 Kudos
Message 1 of 15
(3,501 Views)

I can't test the code because I can't take data with this PC, but I'm pretty sure the problem is with your array indices -- the numbers are right, just hooked up to the wrong dimension.

 

Try this out.

 

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 2 of 15
(3,487 Views)

DarkMarc uses LabVIEW 8.0, so he won't be able to open your 8.6 attachment.

 

If th indices are supposed to be switched, it might be easier to move the "transpose" operation elsewhere instead.

0 Kudos
Message 3 of 15
(3,482 Views)

Yeah thats right I just checked, and I can't open the file because it's 8.6 😞 Although I can have a look at it when i get home because i have 8.6 at home.

 

I just realised that I think I may have done it wrong in my original file. I thought that array was 1 dimensional for some reason, but actually I think it's 2 dimensional so maybe thats why it's not working. However, I only really need to plot the latest row (updated 500 times a second) so perhaps I can just convert it to a 1 dimensional array. What do you guys think?

0 Kudos
Message 4 of 15
(3,480 Views)

Am I correct in saying that the original array that is outputted from AI read has 25 columns, and grows by 500 rows every second?

0 Kudos
Message 5 of 15
(3,478 Views)

DarkMarc86,

 

If I understand your program correctly,  the values coming out of AI Read is a 2D array of doubles. One easy to check what type of data type is coming out is to click on the wire and press Ctrl + H to pull up the context help window. Also, a wire that is double lined is an array. The data type is determined by the color of the wire itself. For example, the color pink represents a string. Then you are using the for loop to extract each element in the array and performing some functions in them. 

 

Since the scan rate is set to 500, you are getting 500 samples a second.  So your conclusions of having 25 columns which grow by 500 rows  in the original array every second would be correct.  Since you transpose this array, it looks like 25 rows with 500 columns in them.

 

Hope this helps!

 

Warm regards,
Karunya R
National Instruments
Applications Engineer
Message 6 of 15
(3,443 Views)
I tried opening the file at home but it says that I don't have any of the AI functions (such as AI read.vi and AI config.vi) but I checked the drivers CD and it says that I have everything from the data acquisition area installed. Does anyone know what the problem could be.
0 Kudos
Message 7 of 15
(3,414 Views)
It sounds like you don't have the traditional DAQ drivers installed. There are two types of DAQ drivers. The current one is called DAQmx. This is what gets installed by default. The AI functions you mention are part of the obsolete traditional DAQ but those drivers are also included on the driver CD. They just have to be specifically selected for installation.
0 Kudos
Message 8 of 15
(3,406 Views)
Hmm, I thought I installed everything from the data acquisitiom area though. So am I looking for something which says "traditional DAQ drivers?"
0 Kudos
Message 9 of 15
(3,403 Views)
Yes. You can open MAX (Measurement & Automation Explorer) and expand the software listing to see what is installed.
Message Edited by Dennis Knutson on 02-22-2009 05:04 PM
0 Kudos
Message 10 of 15
(3,401 Views)