473,385 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

2 dimensional array-->1 dimensional array

Hi,

Trying to wrap my head around the following problem.
Let's say I have a 2 dimensional array:

Dim arrS(3,4) As String

I want to copy the subarray arrS(0,) to a new array arrLoop(4) As
String.

How can one do this?

In fact, I may be taking the wrong approach entirely, so I'll spell out
my use case:
1. Let's say I have 4 lines of text.
2. Each line has up to 5 pre-defined parameters (words) in it, in a
non-predefined order.
3. I scan the line, taking note of when a predefined word is found and
what its word position is.
4. I repeat this for each line.

at the end of the process, I want to know which parameter order was
most commonly found across the lines of text.

Any ideas on how to approach this?

May 19 '06 #1
2 1495
>I want to copy the subarray arrS(0,) to a new array arrLoop(4) As
string.

Somewhat like:

for i as integer = 0 to ArrS.GetUpperbound(1)
arrLoop(i) = ArrS(0, i)
next

?????

But I'm not sure, i understand your problem... Is your text somewhat
like this:

aaaa bbbb cccc dddd eeee
ffff gggg hhhh iii jjjj
kkkk bbbb cccc llll
bbbb mmmm nnnn oooo

- And your problem is to detect the most common parameter ("bbbb") and
its position in the text: (0, 1);(2,1);(3,0) ? Or have I misunderstood?

May 19 '06 #2
a) Is there a way of copying the array without going through an
expensive loop?
I was hoping that simply saying arrLoop = ArrS(0,) - but it doesn't
work.

b) Image the 5 strings are:
aaaa bbbb cccc
xxxx yyyy zzzz
dddd eeee pppp
eeee gggg kkkk
aaaa cccc bbbb

Also assume that:
Group1: aaaa, dddd
Group2: bbbb, eeee
Group3: xxxx, yyyy,zzzz
Group4: gggg, kkkk, pppp, cccc

I want to know what the most common Group in word position 1 is.
So in the example above, we have:
Group 1 = 3, Group2 = 1, Group3 =1 for the first word position. I want
a computationally efficient way of determining that its Group 1 with 3
hits, followed by Group2 and 3 with 1 hit apiece...and then the same
thing for Word2 and Word3.

Thanks.

May 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: JT | last post by:
how do i determine how many items are in an array? the following code creates an array of values each time a space is found in a name field. the problem is that sometimes names have middle...
29
by: Hamish | last post by:
I'm trying to use an C API which is for geometry calculations. The function requires an argument for an array of polygons: coordpt **polygons //-1] where coordpt is: typedef struct {...
9
by: Rui Sampainho | last post by:
Hi Is there any command to transfer the contents of a datatable to an array. What I'm looking for is sort of a bulk process, not an iteration with a loop based on a field by field or row by row...
104
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
14
by: Peter Hallett | last post by:
I would like to set up a string array as a class member, or field, and then populate this array by reading in from a text file, but I cannot find the appropriate syntax. The getter and setter are...
0
by: Tao | last post by:
hi. guys, I have a int List. Can I convert List to a int array. For the performance reason, I do not want to copy int to a int. thanks.
272
by: Peter Olcott | last post by:
http://groups.google.com/group/comp.lang.c++/msg/a9092f0f6c9bf13a I think that the operator() member function does not work correctly, does anyone else know how to make a template for making two...
3
by: gihope | last post by:
Can anyone tell me why I am not allowed to bind a two or multi dimensional array to GridView and possibly suggest how they would deal with similar scenarios? The array is simply a two dimensional...
4
by: jgendr2 | last post by:
So here is my problem I do not know if there is another way to solve this without using arrays....but I am assuming that I DO need to use arrays....Anyways FIRST ARRAY (SINGLE): $results =...
6
zorgi
by: zorgi | last post by:
I have multidimensional (tree) array of form like this: $a = array ( "t" => array("b") "d" => array( "p" => array("b") "n" => array( ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.