LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array problems

HI,
here i am again.
 
I'm stuck with my array structure. I need several things. But i jsut don't know how to do so!
 
I need a Array that has 13 colums with 1024 rows.
The data is from a for-loop. Every 1024 data points that come out have to been stored at the first colum, the second loop at the second row and so on.
 
Every time i make an array i get errors that indicate that i have the wrong dimension. But i just don't got a clue how to make a good, working VI for storing data in a array!
 
I hope someone can help me!
 
greetings from Holland
0 Kudos
Message 1 of 12
(2,954 Views)
You didn't say how you're making your array, and without looking at code it's pretty much a wild guess to figure out what's wrong. Are you auto-indexing, or trying to build an array manually. If you're basically collecting 1024 samples for 13 items you can just auto-index like this:



Message Edited by smercurio_fc on 03-31-200611:36 AM

Message 2 of 12
(2,945 Views)

Hello,

If you wire the 1024-point array from within your For Loop to the loop border, then you will get a 2D array output from the loop containing all your data points...but it will be a 13x1024 array, and it sounds like you need a 1024x13 array.  You can transpose the array with the Transpose 2D Array function in the Array palette.

I hope this helps...if you still have questions, post a sample VI demonstrating the problem you're having.

-D

0 Kudos
Message 3 of 12
(2,942 Views)
Oops, got thrown off by the description where he says "second loop at the second row, and so on". I read the earlier part, but that was the last thing I had read, so 13x1024 stuck in my mind. Yeah, a Transpose 2D Array function would do the trick. Thanks, Darren.

Update pic:


Message Edited by smercurio_fc on 03-31-200611:44 AM

Message 4 of 12
(2,941 Views)

srry guys, here is the attachment, maybe that will help!

 

0 Kudos
Message 5 of 12
(2,934 Views)

Ah, the ol' dynamic datatype...now I see why you were having problems.  It looks like you're on the right track with the "From DDT" function you dropped on the diagram.  You have it correctly configured to convert to a 1D array of scalars...just build that array up on the For Loop border, then use a Transpose 2D Array function outside the loop to switch around the row/column dimensions, as shown in the previous screenshot.

Good luck,
-D

Message 6 of 12
(2,927 Views)

Now it just keeps on putting the same data of each 13 loops behind each other...

This is so irritating, espacially when it's a school project and it has to be finished at monday!

could you please check my vi again?:$

i feel so a noob right now

0 Kudos
Message 7 of 12
(2,921 Views)
I would suggest that if you just use the numeric functions you can eliminate the dynamic datatype all-together, since you're just doing numerical calculations. Also, you should place the write to file outside of both loops so that you write the data once, rather than writing to file each iteration, which is 12x1024=12,288 times.
0 Kudos
Message 8 of 12
(2,920 Views)
Damned, it just won't go the way i wont it to... It's really frustrating...
 
if someone else got any idea's, just post them plz
 
THANKS A LOT!!!!Smiley Sad
0 Kudos
Message 9 of 12
(2,906 Views)

Ok, it looks like your array actually contains just a scalar value (in my first glance at your code I thought it contained an array of values).  Here is a simple screenshot of the sequence of steps you would take regarding your two For Loops to generate the data the way you want:

The Transpose 2D Array needs to be done outside the main loop to get the dimensions the way you want them.  Also, the previous suggestion of doing the File I/O outside the main loop is a good idea, it will make your code faster.

Good luck,
-D

Message Edited by Darren on 03-31-200612:58 PM

Message 10 of 12
(2,891 Views)