newbie question on multi-dimensional array

Hi all, 

I have a real lame question about multi-dimensional array operation.
Suppose I have defined a two-dimensional array "Array(10,10)". If I
want to use the Excel function "Average" to compute the average value
of Column, say 10, of that 2D array, is there any way to realize it? I
tried "Application.Average(Array(:,10))", but apparently the Excel
doesn't like that. (You can see I am a Matlab guy, so please don't
laugh at me:) )
Any comments are extremely welcome.


-- 
sammus


------------------------------------------------------------------------
sammus's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=33092
View this thread: http://www.excelforum.com/showthread.php?threadid=529036

0
4/2/2006 11:18:41 PM
excel.newusers 15348 articles. 2 followers. Follow

2 Replies
327 Views

Similar Articles

[PageSpeed] 33

s,
'--------------------- 
  Sub ArrayTest()
     Dim i As Long
     Dim j As Long
     Dim arrNums() As Double
     Dim arrCol As Variant
          
    '11 columns
     ReDim arrNums(0 To 10, 0 To 10)
    'Fill the array
     For i = 0 To 10
         For j = 10 To 0 Step -1
             arrNums(i, j) = i + j
         Next
     Next
     
    'If you set row_num or column_num to 0 (zero), then
    'Index returns the array of values for the entire column or row
    
     arrCol = Application.Index(arrNums, 0, 10) 'next to last column
     MsgBox Application.Average(arrCol)
  End Sub
'------------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"sammus" wrote in message... 
Hi all, 
I have a real lame question about multi-dimensional array operation.
Suppose I have defined a two-dimensional array "Array(10,10)". If I
want to use the Excel function "Average" to compute the average value
of Column, say 10, of that 2D array, is there any way to realize it? I
tried "Application.Average(Array(:,10))", but apparently the Excel
doesn't like that. (You can see I am a Matlab guy, so please don't
laugh at me:) )
Any comments are extremely welcome. 
sammus

0
jim.coneXXX (771)
4/3/2006 1:05:55 AM
Thank you so much for your enlightening reply. :)


-- 
sammus


------------------------------------------------------------------------
sammus's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=33092
View this thread: http://www.excelforum.com/showthread.php?threadid=529036

0
4/3/2006 2:11:32 AM
Reply:

Similar Artilces:

Mailing List Questions
I've got a rather long mailing list in Excel and am not familiar with = all the calculation features in Excel. Hoping someone can help me with = this. One column is zip codes (5-digit). I would like to know how to make a = list showing the number of entries in each zip code. Basically that's = the question. I'm doing it the old fashion way now.=20 I upload a file at alt.binaries.crafts.pictures to show what I'm asking = about. If you can't get access to it, post what binary group you can, = and I'll post it there also. (Actually 3 files - different formats so = an...

Question about dialog.
I have an application which use several dialogs (CDialog1, CDialog2,...). CDialog1 is popped up by a fuction call as following (Works well): func(...hWnd...)//hWnd is the main windows' handle { CWnd wndParent; if (wndParent.Attach( hWnd ) ) { CDialog1 dlg( &wndParent ); dlg.DoModal(); wndParent.Detach(); } } Now, in CDialog1, I want to start another dialog by using: CDialog2 dlg; dlg.DoModal(); //failed I got run time error. Why? "kathy" <yqin_99@yahoo.com> wrote in message news:1129328476.748520.213520@g43g2000cwa.googlegroups.com... &...

Printing multi copies
I want to print 2 pages per sheet of paper. I have selected Multiple pages per sheet. I indicate that pages I want and preview if find for one copy. If I then indicate that I want 10 copies of the Multiple Pages, then the preview reverts to two pages of the same page. It just duplicates one page twice and I lost the second (different) page I want. This is a printer issue. I've tried to duplicate this, but I cannot with my printer. Might try converting to PDF and then printing. There are free converters around. www.primopdf.com is mentioned here often. -- Mary Sauer http://msau...

Mailbox move question
All, I initiated the movement of several large mailboxes 1 gig plus last night. It did not complete by this morning, so I canceled the move. They canceled just fine, and people have access to their email, but the server is SLOW. It isn't a processor thing either, it is strictly IO from what I can tell. Anyone have similar experience? Any ideas? -Pair On Fri, 28 Jul 2006 13:12:22 -0700, "TwistedPair" <twistedpair@mail.com> wrote: >All, >I initiated the movement of several large mailboxes 1 gig plus last night. >It did not complete by this morning, so I ...

Visio Newbie #2
I just installed Visio 2000 SP2 on my Dell Laptop running Windows XP Home SP2. When I run Visio 2000 I get these errors in my event log over and over again: Event Type: Warning Event Source: MsiInstaller Event Category: None Event ID: 1015 Date: 7/11/2006 Time: 7:05:05 PM User: TGKW001\Thomas R Grassi Jr Computer: TGKW001 Description: Failed to connect to server. Error: 0x800401F0 For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. Does anyone have any idea on this? I know I have an outdated product but it works for what I need. I was running...

NewsGroups Rules Question
There are a couple of Usenet groups that I find useful (like this one, obviously). In one of the groups there are a number of 'Trolls' that I find irritating. I typically generate a 'rule' for the irritating poster(s) that says (in this case) Where the From line contains 'nobody@dizum.com' then delete it This typically works but for this particular person he/she keeps showing. I browsed through all my 'Newsgroup Rules' and the rule that says delete this case shows up four times. But he/she is (as far as I can tell) is never deleted from my v...

Another relationship question
I've been working on this for some time and have yet to get what I need; I'm working on a db to keep track of art shows I apply to and attend, there are three tables: Art Shows - contains ID(auto number), name, address, Contact , etc. Application Data - contains ID(auto number), application due date, fees, year applied, and accepted/declined. Show Results - contains ID(auto number), gross sales, expenses, net sales One show may have many application data entries(one for each year applied to as well as many show results for the same reason. The ID fields are set as...

Question about CEdit and ENTER-TAB keys
I've a CEdit control inside a CDialog, and I want to perform a checkup in the value of the CEdit, but ONLY when the user hits ENTER or TAB. I guess that the TAB can be done using the ON_EN_KILLFOCUS(IDC_EDIT1, OnKillfocusEdit1) map. However, I have not been able to find an event for the Enter case. ON_EN_CHANGE(IDC_EDIT1,OnChangeEdit1) doesn't work for me, since I'd like to perform the check ONLY after an Enter, not anytime the text in the control changes. I also tried overriding OnKeyDown in the CEdit class, but the message is not triggered for Enter key. So, my question is: Is...

Quick questions on setup of 2003?
Can you install Active Directory Connector after Domain prep and Forest prep have been run? If you have run the Domain Prep and Forest prep for 2000, do need to run it for 2003? "LT" <anonymous@discussions.microsoft.com> wrote: >Can you install Active Directory Connector after Domain >prep and Forest prep have been run? Yes. >If you have run the Domain Prep and Forest prep for 2000, >do need to run it for 2003? Yes. -- Rich Matheisen MCSE+I, Exchange MVP MS Exchange FAQ at http://www.swinc.com/resource/exch_faq.htm ...

Re: What is an efficient way to determine if a value is in an array?
Right now I have a list of 300 items, and I want to see if they belon to one of three sets of values. I keep the 300 items in column A o page 1, and on pages 2, 3, and 4 I have the other three lists of value in columns A respectively. Right now I am using a VLOOKUP on each of the three sheets, and if i exists I return the value in the adjacent column, which is always "1". I run this vlookup for each page, and put the return value in th three adjacent columns next to my original value. This works, but the problem is that it returns the dreaded #N/A if i doesnt exist in the page. ...

Outlook Tasks Question
I have user's who e-mail other users of tasks needing to be completed. When an e-mail is received no option in the incoming e-mail allows them to Accept or Decline the task. Does anyone know how to enable this option? Thanks. To send a Task request the user that you are sending to has to be configured in Rich Text, double click the resolved email address in the To field and set to Rich text, of course the recipient needs to use Outlook as well :) "Scott" <scottcukier@hotmail.com> wrote in message news:08b401c3faf3$33284560$a001280a@phx.gbl... > I have user's w...

sample questions to be inserted for the questionnaire/ interviews
I am a Masters degree (business IT) student who is doing a research study on how MS project server 2007 could be utilized as a framework for managing IT projects for any organization to achieve its business value. For this research project I will be conducting several interviews and collecting some information through questionnaires from the organization concerned with. I am just looking for some sample questions to be inserted for the questionnaire and also to be used in business analysis interviews while doing the detailed business analysis with different levels of staff in...

extremely basic question about paragraph indenting
This is a terribly basic question but I can't find the answer in Word Help. How do I indent all the paragraphs of a Word document, not just one para... Michael Well, if you want *all* the paragraphs indented, then maybe you actually want to change the margins? So, for instance, that there is a 2-inch left margin on every page instead of a 1-in margin? To do that, go to Format | Document | Margins (assuming you are using MacWord). (This will partially affect the headers). Otherwise, you can indent more than one paragraph at a time by selecting more than one paragraph at a time, and th...

Question about x.y.z order
My god, I have some excel file, the data sheets have so many columns, and I need order like following, 1.1.1 1.1.1.2 1.1.2.1 1.1.3 1.1.4.2.3 1.2.5 1.10.6 1.11.1 How ever, using the excel order function, it looks like 1.1.1 1.1.1.2 1.1.2.1 1.1.3 1.1.4.2.3 1.10.6 1.11.1 1.2.5 The 1.2.5 shell before 1.10.6, how can I do it? Thanks for help. If you entered the values as: 001.001.001.002 (as many leading 0's as you need for the biggest number) Then your sort would work fine. An alternative is to insert as many empty columns to the right and then using data|text to columns|delimited by ...

Double-Click question
I have a function that is called by both WM_LBUTTONDOWN and WM_LBUTTONDBLCLK messages. However the double-click behavior seems to depend on the state of the system (what exactly I don't know). Can anyone speculate what might cause this? Could it be the time limit between clicks or could the state of the system reduce this time limit? (BTW, what is the limit normally set at?) Thanks, E-Jo Define "state of the system". The double-click behavior is independent of any other consideration of system state unless your code is dependent on the system state. The only thing that th...

free dot interview questions information
..NET database dev questions http://freedownloadablebooks.blogspot.com/2008/03/net-database-dev-questions.html Some general quickies http://freedownloadablebooks.blogspot.com/2008/03/some-general-quickies.html ..NET WebDev interview questions - Part 1 http://freedownloadablebooks.blogspot.com/2008/03/net-webdev-interview-questions-part-1.html ..NET WebDev interview questions - Part 3 http://freedownloadablebooks.blogspot.com/2008/03/net-webdev-interview-questions-part-3.html Electronic engineer interview questions http://freedownloadablebooks.blogspot.com/2008/03/electronic-engineer-interview-...

XML inheritance, question about xml configuration. Thanks
For a long time, I am looking for a way to setup a standard way XML inheritance for my project. I am sure the way I call it is not right, but I think what I need is reasonable. Basically, I want something work like web.config, my project have many levels, on each level, user can put some settings into XML, what I need is a way to give user the ability to change all settings when they want, in the mean time, inherit settings if they are not set in current level, for example, one level 1, I could have setting like <settings> <section id="1"> <pagesize>16</pag...

.pst question
Outlook/Exchange novice here.... I have a user that has archived files to different areas on his laptop. He wants them all to appear in his folder list under Archive Folders. If I copy and paste them into docs and settings\%username%\local settings\application data\microsoft\outlook do i need to rename the files so as not to overwrite the one archived file that is in there? In other words, what is the proper procedure to restore these archived files that are not where Outlook 2k sees them so that they can be viewed in his Archive Folders list? Thank you Hey, What I would do is put...

Single-thread delegate vs multi-thread delegate
I was asked this during an interview. I had not heard about Single- thread delegate or multi-thread delegate. I did a search on google and have not found any reference about either. Anyone can tell me what they are? On 5/4/2010 9:09 PM, Curious wrote: > I was asked this during an interview. I had not heard about Single- > thread delegate or multi-thread delegate. > > I did a search on google and have not found any reference about > either. Anyone can tell me what they are? Could the question have been regarding Multicast vs. Singlecast delegates? An example of ...

Sort Question
Can you sort a cell by color? What version of excel are you using? dwake wrote: > > Can you sort a cell by color? -- Dave Peterson EXCEL 2007 Data / Sort & Filter group / Sort / Sort window should launch / in the Sort On field select Cell Color If my comments have helped please hit Yes. Thanks. "dwake" wrote: > Can you sort a cell by color? Not naturally, but see here for workaround: http://www.ozgrid.com/VBA/Sort.htm -- Best Regards, Luke M "dwake" <dwake@discussions.microsoft.com> wrote in message ne...

Question for Windows Speech Recognition guru
Need advice from Vista Speech Recognition guru. (formal name WSR, for Windows Speech Recognition) The "Analyze Written Documents" feature of WSR appears to be broken. I try to keep up-to-date on three different SR apps, which is not easy, because of the differences. The three SR apps are: 1) Dragon Pro 2) WSR (Vista Speech Recognition) 3) MacSpeech Dictate ....using most recent versions of above 3 apps Without going into the reason _why_ , I would like to be able to speak the following, and have it come out exactly as shown in the two examples below...

User Form Question
Hi, I have created a user form for entering names and addresses. I want the content of the form to go into the next row in a workbook when a button is pressed. I can get it to go to set cells but not the next free cells ? Any advice ? David Can't see your code but have a look at Offset method or defining LastRow in a range. Gord Dibben MS Excel MVP On Mon, 26 Jan 2009 19:51:19 +0000, David <davidjcleland@hotmail.com> wrote: >Hi, > >I have created a user form for entering names and addresses. I want the >content of the form to go into the next row in a workbo...

stupidly easy question
i am having a problem creating a graph with the year on the (x) asix an a value on the (y) axis. when i try and make the graph, the wizar always puts the year as a value, not as the (x) axis... how can i make the year as the(x) axis?! thanks in advance, confused -- leppel Depending on how you've constructed your data in the cells Try to select :" Rows " or " Columns " after you've defined the Source data > Data Range > Series In: Rows Columns "lep...

DLL Question #7
Hi guys, I wanted to create a DLL which uses MFC CRecordset. I do the following steps 1) Create a new class (Class type -->MFC Class Base Class --> CRecordset) 2) it the .h file add the following code #define DLLEXPORT _declspec(dllexport) class DLLEXPORT xx : public CRecordset { ........................... ........................... } Is that the correct way to build a dll with CRecordset "Newbie & Noobie" <NewbieNoobie@discussions.microsoft.com> wrote in message news:09DC429F-8C55-47A5-8A9A-CBBD98AA9051@microsoft.com... > #define DLLEXPORT...

Multi page worksheet question
Hi guys i have a roster that is on a single worksheet. What i want to do is when I change a name into a particular shift it then takes that shift and copies the shift onto another worksheet. So when its done each employee will have a worksheet with just his shifts on it, there are only 5 employee's atm, so instead of them having to go through every day to see what each day has they can just click on their own name and get a roster that has the week setup for them. Does this make sense? if not I can post the roster to show you what it is I want to accomplish. many thanks -- Codger ...