How can I extract a row of data from a 2 dimensional array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Seems a simple question, but I can't find a simple answer:

I have created a two dimensional array. I wish to send the data, a row at a time to a graph plotting routine which is expected a one dimension array.

I could create a temporary one dimensional array and populate from the original array and then pass it to the routine, but this would seem to be long winded (read slow), and may well give me problems, as the previous values in the temporary table are overwritten.

Is there a simple way to create a one dimensional array from a single row of a two dimensional array?

Many Thanks

Smurf
 
Hey Smurf,

I'm not too sure there is a simpler way to go from two-dimensional to one
than what you mentioned. Is there any possibility of using a jagged array
instead of a 2-dim? You could then pass just that element.

You _MIGHT_ find it quicker to create a 2-dim that only has one row then use
the Array.Copy() or the CopyTo() methods to duplicate the desired section,
though it's not really a 1-dim now so may not work either.

Good luck,

John

smurf said:
Seems a simple question, but I can't find a simple answer:

I have created a two dimensional array. I wish to send the data, a row at
a time to a graph plotting routine which is expected a one dimension array.
I could create a temporary one dimensional array and populate from the
original array and then pass it to the routine, but this would seem to be
long winded (read slow), and may well give me problems, as the previous
values in the temporary table are overwritten.
 
Back
Top