473,408 Members | 2,832 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,408 software developers and data experts.

Combine (2) Arrays into a Single Average Array

I know have (2) seperate arrays that hold an undefined number of information. I would like to take array-1 and array-2 and create an average array between the two


array1 array2 arrayAVG
4096 4095 4095.5
4071 4012 4041.5
4000 3812 3906


This would be the idea of how i wnat it, then i would take the arrayAVG and write to a file.
Sep 6 '07 #1
2 2173
kadghar
1,295 Expert 1GB
just create it
if array1 and array2 have the same number of elements and the same indexes, something like this will help:

Expand|Select|Wrap|Line Numbers
  1. dim i as integer
  2. dim arrayAV() as double
  3.  
  4. redim arrayAV(lbound(array1) to ubound(array1))
  5.  
  6. for i = lbound(array1) to ubound(array1)
  7.     arrayAV(i)= (array1(i) + array2(i) )/2
  8. next
hth
Sep 6 '07 #2
Hi,

I created a sample program for you that might help you combine two or more arrays in 1 single array.. you can use this program as a pattern.

Dim x1(2) As String
Dim x2(2) As String
Dim x3(2) As String
Dim i As Integer = 0

For i = 0 To 2
x1(i) = "FName_" & i
x2(i) = "MName_" & i
x3(i) = "LName_" & i
Next

Dim xCombined(8) As String
x1.CopyTo(xCombined, 0)
x2.CopyTo(xCombined, 3)
x3.CopyTo(xCombined, 6)






I know have (2) seperate arrays that hold an undefined number of information. I would like to take array-1 and array-2 and create an average array between the two


array1 array2 arrayAVG
4096 4095 4095.5
4071 4012 4041.5
4000 3812 3906


This would be the idea of how i wnat it, then i would take the arrayAVG and write to a file.
Sep 7 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Ben | last post by:
I have a program which is using a lot of memory. At the moment I store a lot of pointers to objects in std::vector. (millions of them) I have three questions: 1) Lets say the average Vector...
9
by: Charles Banas | last post by:
i've got an interesting peice of code i'm maintaining, and i'd like to get some opinions and comments on it, hopefully so i can gain some sort of insight as to why this works. at the top of the...
8
by: frekster | last post by:
Hi. I used to be able to do this easily in vb 6 via looping and preserving the source array data/size etc. How can I do this in vb.net? I've been trying for a while now and this should be...
3
by: Schroeder, AJ | last post by:
Hello group, I am a relative PHP newbie and I am trying to combine two arrays together, but I also need to keep the keys of one array intact. What I am doing is two SNMP walks against a Cisco...
8
by: RobcPettit | last post by:
Hi, What is the best way to use an array to find moving averages. I want to calculate a 15 day and 41 day m/a. I know my array will need to contain 12 columns, but the rows need to be dynamic. The...
5
by: nelly0 | last post by:
developing a program that will manipulate noise levels (measured in decibels) that is collected by car manufacturers. These noise levels are produced at seven different speeds by a maximum of six...
9
by: nico3334 | last post by:
Hi, I have 2 arrays (Each As a String), and I would like to combine these into a new single array. Is there an easy way of coding this? For example, I want "arrData" and "arrID" to be combined into...
5
by: jc | last post by:
Hi. I am in a situation with an engineering application involving monitoring of press operations. This involves storage of numbers for both an X and Y arrays. The number of element within the...
5
by: macca | last post by:
Hi, I'm doing an two ldap_search queries and I need to combine the two results into one single array containing all the results from each but removing duplicates. I have tried built in php...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.