Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically storing matrix values in C#

I'm trying to build an application in c#.net

Here I am having two single-dimensional arrays of same size For example, I have matrices M and N like the below structure:

       M[0] M[1] M[2] M[3] M[4]
 N[0]   
 N[1]
 N[2]
 N[3]
 N[4]

Here I have assigned my values of M[0].... & N[0]...... to them so that I get a matrix like:

    5     6     4     8
4

8

7

2

Note: I made this values to generate dynamically. I have succeeded till this step.

But I like to store the values in another array (maybe a jagged array or something else) in 2x2 matrix in this format:

      A[0]  A[1]
 B[0]  5     4       (this is the values of M[0] and N[0])

 B[1]  6     4       (this is the values of M[1] and N[0])

 ..............
 B[4]  5     8       (this is the values of M[0] and N[1])

When the first row of N[0] is completed it has to continue with the next row. I just need some for how to implement this in C#??

like image 567
Vivek Dragon Avatar asked Jan 07 '13 06:01

Vivek Dragon


1 Answers

For Storing dynamically you should know the basics of 2d and 3d

Refer here

2-D arrays: dotnetperls.com/2d-array

multidimensional arrays: msdn.microsoft.com/en-us/library/2yd9wwz4(v=vs.71).aspx

like image 51
A2 NightWing Avatar answered Sep 21 '22 06:09

A2 NightWing