vieira Posted February 17, 2009 Report Share Posted February 17, 2009 Hi, I need to do a square matrix with aleatory numbers between 1 and 10. The Array dimension must be entered by control and it has to be >= 3. I have some problems in the attachment, how can help me to solve it?...I have to use For loop. Thank you in advanced. Quote Link to comment
jcarmody Posted February 17, 2009 Report Share Posted February 17, 2009 QUOTE (vieira @ Feb 15 2009, 08:59 PM) I need to do a square matrix with aleatory numbers between 1 and 10. The Array dimension must be entered by control and it has to be >= 3. Once I figured out that "aleatory" means random, I got confused about what you're trying to do. The order of a matrix having m rows and n columns is m x n, so your square matrix cannot have an order of 3 (unless you 1.732 rows/columns). If I make the minimum = 4 I come up with the attached. Is this what you want? Edit. Oops... this looks like homework (in my excitement, I only noticed it after I posted). A hint: don't worry about the Initialize Array function; you know you need a two-dimensional array. The answer lies in nested http://zone.ni.com/devzone/cda/tut/p/id/7588' target="_blank">For Loops... Jim Quote Link to comment
vieira Posted February 17, 2009 Author Report Share Posted February 17, 2009 Yes, aleatory means random numbers between 1 to 10. I need a matrix nxn, n rows and n columns (for example: 3x3, 4x4,5x5, 6x6, 7x7,....). The "n" must be entered by control. Thank you. Quote Link to comment
ragu Posted February 17, 2009 Report Share Posted February 17, 2009 QUOTE (vieira @ Feb 16 2009, 01:21 PM) Yes, aleatory means random numbers between 1 to 10. I need a matrix nxn, n rows and n columns (for example: 3x3, 4x4,5x5, 6x6, 7x7,....). The "n" must be entered by control. Thank you. hi I got somewhat what do you want.Just find the attachment.If it's not help u plz explain ur requirement once again.. Quote Link to comment
jcarmody Posted February 17, 2009 Report Share Posted February 17, 2009 QUOTE (vieira @ Feb 16 2009, 07:21 AM) Yes, aleatory means random numbers between 1 to 10. I need a matrix nxn, n rows and n columns (for example: 3x3, 4x4,5x5, 6x6, 7x7,....). The "n" must be entered by control. Thank you. Ok, you've confirmed what I thought. Have you tried nesting two For Loops and building your array? Put your Random Number stuff inside the inner loop, wire the "n" control to the "N" terminals and wire the random number through both loops to a 2D array indicator on the outside (with indexing enabled in both loops, of course). Jim Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.