# 2D Array Help

## Recommended Posts

Im trying to do this problem that has a 2D array with 12 rows and 6 columns. It wants the first row to only display numbers 0-1, the second row 1-2, third 2-3, and so on to the final row. Any suggestions on how i can do this? not sure where to even start

##### Link to comment

Where do your numbers originate?  You can use nested For loops, an Addition node and a random number generator.

##### Link to comment

Where do your numbers originate?  You can use nested For loops, an Addition node and a random number generator.

The numbers i assume are random generated, for the addition node what am i adding? The random number generator and a constant??

##### Link to comment

You'll add the random number and a different constant for each row you make.  The random number generated will be between 0 and 1, so, for the first row you'll need to add zero; add one for the second row, etc.  Try making nested loops and see what you get.  Do you understand how rows & columns of a 2D array are generated in this fashion?  Are you familiar with the For loop's "i" and "N" terminals?

Show me your code, Wireworker, and I'll show you mine.

##### Link to comment

Also did you take a picture of a piece of paper, of a printed front panel, of a VI?  Is this an assignment?  Not that we won't help with assignments but we won't just do the work for you.

##### Link to comment

i tried making each row with the for loop to get the +1 succession for each row but it just gave an error

Also did you take a picture of a piece of paper, of a printed front panel, of a VI?  Is this an assignment?  Not that we won't help with assignments but we won't just do the work for you.

its an assignment but i just had zero clue where to even begin on it. the only instruction was whats on the paper

Untitled 4.vi

##### Link to comment

You made a 12 dimensional array.  That is not what you want.  Rarely do you need more than 2, this problem really only needs two, rows and columns.  You have Rows, Columns, Pages, Books, Shelves, Bookshelves, Aisles, Libraries, Towns, States, Countries, and Planets.

There are many ways to go about doing this.  They will all involve some type of sorting mechanize, Maybe calling the coerce in range for the 12 different ranges, then using the conditional concatenating to build them into the rows.  Here is a quick example on getting data in a range.  This is a snippet and can be brought into LabVIEW as executable code.

Also here is some free online training to explain the basics of LabVIEW, but I assume that's why you are taking the course.  Links at the bottom.

https://decibel.ni.com/content/docs/DOC-40451

##### Link to comment

You made a 12 dimensional array.  That is not what you want.  Rarely do you need more than 2, this problem really only needs two, rows and columns.  You have Rows, Columns, Pages, Books, Shelves, Bookshelves, Aisles, Libraries, Towns, States, Countries, and Planets.

There are many ways to go about doing this.  They will all involve some type of sorting mechanize, Maybe calling the coerce in range for the 12 different ranges, then using the conditional concatenating to build them into the rows.  Here is a quick example on getting data in a range.  This is a snippet and can be brought into LabVIEW as executable code.

Also here is some free online training to explain the basics of LabVIEW, but I assume that's why you are taking the course.  Links at the bottom.

https://decibel.ni.com/content/docs/DOC-40451

i tried it with 2D array and it told me it wouldn't allow it because it wasn't 12 so i made the array 12

##### Link to comment

They will all involve some type of sorting mechanize, Maybe calling the coerce in range for the 12 different ranges,

We can't see the real question so it may just be a trivial task to generate the numbers - which doesn't require binning (sorting or range checking.)

The OP needs his LabVIEW eureka moment so non trivial solutions not directly addressing the question will just be confusing.

##### Link to comment

We can't see the real question so it may just be a trivial task to generate the numbers - which doesn't require binning

Yeah reading it again I suspect this is really all the assignment is.

##### Link to comment

You have Rows, Columns, Pages, Books, Shelves, Bookshelves, Aisles, Libraries, Towns, States, Countries, and Planets.

Wow, where do those come from? My LabVIEW calls your Books vol and the rest is just dimX

Or did you just make that up

And what comes after Planets? Solar systems? Quandrants? Universes? How much further can we go?

##### Link to comment

Wow, where do those come from? My LabVIEW calls your Books vol and the rest is just dimX

Or did you just make that up

And what comes after Planets? Solar systems? Quandrants? Universes? How much further can we go?

Edited by ShaunR
##### Link to comment

Wow, where do those come from? My LabVIEW calls your Books vol and the rest is just dimX

Yeah I made them up, but I've often thought about what you could name higher level dimensions like this.  It is hard to conceptualize dimensions this large, and I think putting in these terms makes it easier to describe to people.  Go to Library 4, go to Aisle 1, get Bookshelf 3 and the first shelf on it, grab the second book, turn to page 4, and you'll find the 2D array of data you want.

##### Link to comment

You made a 12 dimensional array.  That is not what you want.  Rarely do you need more than 2, this problem really only needs two, rows and columns.  You have Rows, Columns, Pages, Books, Shelves, Bookshelves, Aisles, Libraries, Towns, States, Countries, and Planets.

This is probably the most concise, easy to understand conceptualisation of multi-dimensioned arrays that I have ever seen!!

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
• ### Similar Content

• By torekp
So I created a DLL from a Labview VI that has a 2D array input (and some scalar inputs) and some 2D array outputs.  Labview creates a .h file with these lines

And then it defines the 2D array arguments to my function as being of this type: "void __cdecl Linear_discrim_4dll(DoubleArray *dataObsFeat, int32_t grpAsz," etc etc.  Trouble is, I have no idea how to fill out this structure so that the DLL can use it.  Say for simplicity I had a 2 by 3 input called dataObsFeat with elements {1,2,3; 11,12,13}; how would I create the object with these values in C or C++ and pass it to the function?  I am a total C++ noob, in case it isn't obvious.
• By Grey
Hi,
I'm having a excel database with me. The excel sheet contains different data types.
Column A consists of seriall Number (Integer), Column B consists of instrument description (Strings), Column C consists of model Number (Number with special characters), Column D consists of instrument Calibration date (Date), Column E consists of instrument Calibration due date and so on......
What i want to do is that i need to extract the excel sheet's content in to 2D array.
And using array functions i want to compare the date and accordingly i want to do some calibration alert system.
the questions is how i can make a 2D array from a excel sheet consists of different data types?
any help?
thanks
×