# Vector Declaration

 Register Blogs Members List Search Today's Posts Mark Forums Read

 June 16, 2010, 11:15 Vector Declaration #1 Member   Tony Join Date: Jun 2010 Posts: 54 Rep Power: 9 Hi, I'm trying to declare a vector list inside a for loop while reading vectors from another list. Here is the for loop. I'm getting an error on the vector delcaration. for(int c=0; c > nacHubGrd[c,0]=nacLocation[c]; Info<

 June 17, 2010, 02:49 #2 Senior Member   Stefan Herbert Join Date: Dec 2009 Location: Darmstadt, Germany Posts: 129 Rep Power: 11 Hi Tony, you have to declare and initialize your field before accessing single columns. A vectorListList of size nxm can be declared and initialized zero as follows: Code: `List > nacHubGrd (n, List(m, vector::zero))` Its working top down and tells you that your vectorListList is set to size n and is holding vectorLists of size m which are holding vectors. You can access single columns by e.g. Code: ```nacHubGrad[i][j] //one single vector nacHubGrad[i] // one of the vectorLists``` Regards, Stefan

 June 17, 2010, 11:27 #3 Member   Tony Join Date: Jun 2010 Posts: 54 Rep Power: 9 Thanks a lot Stefan, that worked perfectly! ok, now it's getting a little bit more complicated and I need to do another list. Im trying: List > > bladePoints (turbNum,bladeNum, List(3, vector::zero)); but its not working, Any suggestions? Thanks! Last edited by tonyuprm; June 17, 2010 at 13:44.

 June 18, 2010, 08:21 #4 Senior Member   David Boger Join Date: Mar 2009 Location: Penn State Applied Research Laboratory Posts: 146 Rep Power: 10 It's proof by induction! Actually, it is just a simple extension of Stefan's example, but maybe formatting it a little differently will help you to understand: Code: ```label l(2),m(3),n(4); List > > bladePoints ( l, List > ( m, List ( n, vector::zero ) ) );``` __________________ David A. Boger

 June 21, 2010, 12:17 #5 Member   Tony Join Date: Jun 2010 Posts: 54 Rep Power: 9 Thanks David!

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

All times are GMT -4. The time now is 10:03.