adding dimension to 2d array

This is a discussion on adding dimension to 2d array within the labview forums in Programming Languages category; Have 2D array completed: 1 2 3 4 5 6 7 81 2 3 4 5 6 7 8Need to add dimension:1  1 2 3 4 5 6 7 81  1 2 3 4 5 6 7 82  1 2 3 4 5 6 7 8 etc...

Go Back   Application Development Forum > Programming Languages > labview

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 07-08-2008, 03:40 PM
markfranklin
Guest
 
Default adding dimension to 2d array

Have 2D array completed: 1 2 3 4 5 6 7 81 2 3 4 5 6 7 8Need to add dimension:1  1 2 3 4 5 6 7 81  1 2 3 4 5 6 7 82  1 2 3 4 5 6 7 8 etc
Reply With Quote
  #2  
Old 07-08-2008, 04:10 PM
smercurio_fc
Guest
 
Default Re: adding dimension to 2d array

Is that first column supposed to be the "page" for the 3D array? A Build Array is what you need to use.


Example_VI.png:
http://forums.ni.com/attachments/ni/...Example_VI.png
Reply With Quote
  #3  
Old 07-08-2008, 04:10 PM
lmtis
Guest
 
Default Re: adding dimension to 2d array

Or if you are creating a constant you can right click on it and select add dimension.
Reply With Quote
  #4  
Old 07-08-2008, 04:10 PM
markfranklin
Guest
 
Default Re: adding dimension to 2d array

Thank you for the quick replies. One problem remains, I do not have a second 2D array for the build function.I simply have a dimension value, which varies of course.
Reply With Quote
  #5  
Old 07-08-2008, 04:10 PM
smercurio_fc
Guest
 
Default Re: adding dimension to 2d array

markfranklin wrote:One problem remains, I do not have a second 2D array for the build function.If you have a 1D array then make it into a 2D array using the same function. Please read the documentation on Build Array.I simply have a dimension value, which varies of course.I have no idea what this means.
Reply With Quote
  #6  
Old 07-08-2008, 04:40 PM
markfranklin
Guest
 
Default Re: adding dimension to 2d array

The third dimension (shown as 1 and 2 on far left of first example) is simply a card number that needs to be stored with the 2D array of data. I was hoping that this card number could be a third dimension to ease look-ups later.
Reply With Quote
  #7  
Old 07-08-2008, 04:40 PM
Ravens Fan
Guest
 
Default Re: adding dimension to 2d array

Are you actually wanting to create a 3 dimensional array?  Or do you just want to add another row (or column) to a 2 dimensional array?
Reply With Quote
  #8  
Old 07-08-2008, 04:40 PM
markfranklin
Guest
 
Default Re: adding dimension to 2d array

I believe that a 3D array would serve me best.
Reply With Quote
  #9  
Old 07-08-2008, 05:10 PM
smercurio_fc
Guest
 
Default Re: adding dimension to 2d array

The thing you have to keep in mind with multi-dimensional arrays is that you can't have different number of elements for each row/column/page. This means that if you had a 2D array, you can't have, for example, row1 have 5 elements and row2 have 7 elements. Each row has to have the same number of columns. (The equivalent is true for columns). For a 3D array, each page has to have the same size 2D array. Thus, if you want to have the first page with a 2D array of 2 rows and 8 columns, and the second page be a 2D array of 1 row and 8 columns, you can't do that. The second page must be the same size - 2 rows and 8 columns. If this is not acceptable for your application, then you must change your data structure. In your initial post you provided a small snippet, which seemed to imply that you were adding pages, with each page being the same size. Is this true?
Reply With Quote
  #10  
Old 07-08-2008, 05:40 PM
markfranklin
Guest
 
Default Re: adding dimension to 2d array

Thank you. An instrument VI outputs a 2D array for each card in the instrument (card number can vary).Each time it outputs a 2D array, there is a card number associated with the data.I had thought that it would be best to add a dimension for including the card number.Perhaps that is a bad idea?I am beginning to think that building or appending the 2D array to more simply include the the card number.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 06:01 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.