473,791 Members | 3,071 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combine (2) Arrays into a Single Average Array

25 New Member
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 2192
kadghar
1,295 Recognized Expert Top Contributor
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
aliasruel
73 New Member
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(xComb ined, 0)
x2.CopyTo(xComb ined, 3)
x3.CopyTo(xComb ined, 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
4628
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 is of size 2. How much memory can I save by storing my pointers in c++ arrays, rather than vectors.
9
6675
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 function (which was translated from Fortran code), among other heinous and numerous declarations, is this bit: static float bbuff; static int bkey; static int buse;
8
4592
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 an easy task but it just isn't clicking. For some reason, the preserve doesn't seem to be working.
3
8211
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 router in which I expect the script to return the interface number along with a small description of the interface type, like this: Array (
8
2367
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 row size will need to be aminium of 50 rows. So far Im thinking of either creating 2 arrays, one for 15 and one for 41 day m/a. Keeping them each to that row size then iterate through them creating new arrays when new data added. Eg when 16 data...
5
3887
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 different models of cars that are produced by the car manufacturer. Task 1 Step 1: Create a directory called Assignment02 and create the files of steps 2, 3 and 4 in this directory as well as your project file. Step 2: Create a file called...
9
24200
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 a new array: "arrTotal". If anyone could give me some coding examples, I'd greatly appreciate it. Thanks!
5
4074
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 arrays varies slightly but should be identical for a singular press operation. One approach is to store an element in a row. This would be 6000 rows (3000 elements/axis * 2). This seems excessive for a single operation. Also, I have no...
5
3600
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 functions such as array_merge (which gives me duplicates) and array_unique which does not work either.
0
9669
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10427
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9995
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5431
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.