yhong

Hi,

I am making a data process project. I am using jogged array to collect the data from DAQ card, the structure is like the following

public s(2)() as string

public s1(100) as string

public s2(100) as string

public s3(100) as string

s(0)=s1

s(1)=s2

s(2)=s3

now I would like to convert s into a 2-dimentional array with row as channel and column as sample data, like above sample, the new array should be tt(2,100), anybody know in vb.net there are some simple way to do that

I know I can use two -for cycle to do that, but I would like to use some functions if they are in vb.net.

Thx




Re: Visual Basic Language Array Operation

JohnWein

A lot of duplication but:

Public tt(2, 100), s(2), s1(100), s2(100), s3(100) As String

You only need the tt(2,100) array.




Re: Visual Basic Language Array Operation

yhong

As fact as, I only can get data channel by channel in 1-dimentional array, so this is reason why I have to combine them by myself to 2-dimentional array.






Re: Visual Basic Language Array Operation

JohnWein

Does my post answer you question





Re: Visual Basic Language Array Operation

yhong

no, your answer is not my question.

1-dimentional array s1, s2 ,s3 are three channel, get one by one,

2-dimentional array ss is my target array for my further process.

I use jog array is for easy to handle s1,s2, s3, is it clear

actually, i can use arraylist instead of jog array as well.






Re: Visual Basic Language Array Operation

JohnWein

I have no idea what you question is. Sorry.





Re: Visual Basic Language Array Operation

Alex Moura

I don't know of any easy way to do the conversion that you're mentioning. Since the conversion requires that each of the subarrays have the same length, it's not something that is always possible.

Can I ask why do you want to change it into a two dimensional array The syntax for accessing that isn't going to be much better anyway: s(0)(1) vs s(0,1)






Re: Visual Basic Language Array Operation

yhong

Actually, my next process function only accept 2-dimentional array, otherwise my previous process only get data one channel by channel, inorder to handle data easy, so I use jog array, and then I would like to convert to 2-dimentional array. This is reason! but right now I use 2 foreach to fix this problem( I aslo think it is easies way in Vb.net). but anyway, I appreciate everybody who response my question.