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

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
 
J

John Spiegel

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top