ME 142 Engineering Computation I Using Excel Arrays in Functions.

Slides:



Advertisements
Similar presentations
Question Bank. Explain the syntax of if else statement? Define Union Define global and local variables with example Concept of recursion with example.
Advertisements

R for Macroecology Aarhus University, Spring 2011.
Modeling using VBA. Covered materials -Userforms -Controls -Module -Procedures & Functions -Variables -Scope.
Chapter 1 Computing Tools Data Representation, Accuracy and Precision Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction.
Maths for Computer Graphics
CIS 101: Computer Programming and Problem Solving Lecture 9 Usman Roshan Department of Computer Science NJIT.
Lecture 7 Sept 29 Goals: Chapters 5 and 6. Scripts Sequence of instructions that we may want to run can be stored in a file (known as script). by typing.
Lecture 6 Sept 15, 09 Goals: two-dimensional arrays matrix operations circuit analysis using Matlab image processing – simple examples.
Pam Perlich Urban Planning 5/6020
Matrix Mathematics in MATLAB and Excel
CE 311 K - Introduction to Computer Methods Daene C. McKinney
Warm-up 1.Review notes from Friday. 2.What is the dimension of the matrix below?
4.2 Adding and Subtracting Matrices 4.3 Matrix Multiplication
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
ME 142 Engineering Computation I Macros. Key Concepts Macro Overview Recording a Macro Running a Macro Editing a Macro Using Controls.
Prepared by MURLI MANOHAR PGT (COMPUTER SCIENCE) KV,B.E.G., PUNE.
Fortran- Subprograms Chapters 6, 7 in your Fortran book.
Portfolio Statistics  Portfolio Expected Return: E(r p ) = w T r  Portfolio Variance:  2 p = w T  w  Sum of portfolio weights: = w T 1 –where w is.
Computer Programming (TKK-2144) 13/14 Semester 1 Instructor: Rama Oktavian Office Hr.: M.13-15, W Th , F
Algebra 2: Lesson 5 Using Matrices to Organize Data and Solve Problems.
IE 212: Computational Methods for Industrial Engineering
ME 142 Engineering Computation I Variables, Equations & Functions Introduction to Basic Programming Language.
AGB 260: Agribusiness Information Technology Arrays and Array Formulas.
Chapter 17: Arrays Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Class 3 Programming in Visual Basic. Class Objectives Learn about input/output Learn about strings Learn about subroutines Learn about arrays Learn about.
1 Week 3: Vectors and Matrices (Part III) READING: 2.2 – 2.4 EECS Introduction to Computing for the Physical Sciences.
259 Lecture 13 Spring 2013 Advanced Excel Topics – Arrays.
ME 142 Engineering Computation I Macros. Key Concepts Macro Overview Recording a Macro Running a Macro Editing a Macro.
AGB 260: Agribusiness Information Technology Arrays and Array Formulas.
Today’s lecture 2-Dimensional indexing Color Format Thread Synchronization within for- loops Shared Memory Tiling Review example programs Using Printf.
 A spreadsheet is a type of software which you can put and sort out data. It is also known as ‘Microsoft Excel’ What is a spreadsheet?
Class Opener:. Identifying Matrices Student Check:
ME 142 Engineering Computation I Exam 2 Review VBA.
Working with Arrays in MATLAB
ME 142 Engineering Computation I Using Subroutines Effectively.
CIS100 Test 1 Review REACH Computer Resource Center.
Chapter 2 Lesson 3 Subtracting Integers pgs What you will learn: Subtract Integers Evaluate expressions containing variables What you will learn:
ME 142 Engineering Computation I Matrix Operations in Excel.
ME 142 Engineering Computation I Input, Output & Documentation.
2.1 Solving One Step Equations. Addition Property of Equality For every real number a, b, and c, if a = b, then a + c = b + c. Example 8 = For every.
3.6 Solving Systems Using Matrices You can use a matrix to represent and solve a system of equations without writing the variables. A matrix is a rectangular.
ME 142 Engineering Computation I Using Subroutines Effectively.
ME 142 Engineering Computation I Matrix Operations in Excel.
1 CSC103: Introduction to Computer and Programming Lecture No 19.
ME 142 Engineering Computation I Input, Output & Documentation.
General Computer Science for Engineers CISC 106 Lecture 15 Dr. John Cavazos Computer and Information Sciences 03/16/2009.
Lecture 15: Course Review BJ Furman ME 30 16MAY2011.
Engineering Computing I Chapter 5 Pointers and Arrays.
Section – Operations with Matrices No Calculator By the end of this lesson you should be able to: Write a matrix and identify its order Determine.
CHAPTER 07 Arrays and Vectors (part II). OBJECTIVES In this part you will learn:  To pass arrays to functions.  Basic searching techniques.
ME 142 Engineering Computation I Interacting with Spreadsheets.
SEQUENTIAL AND OBJECT ORIENTED PROGRAMMING Arrays.
3.5 Perform Basic Matrix Operations Add Matrices Subtract Matrices Solve Matric equations for x and y.
ME 142 Engineering Computation I More Loops & Arrays.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 7A Arrays (Concepts)
Precalculus Section 14.1 Add and subtract matrices Often a set of data is arranged in a table form A matrix is a rectangular.
ENGINEERING 2304 Computer Programming for Engineers ENGR Spring 2015 Week 8.
Matrices. Matrix - a rectangular array of variables or constants in horizontal rows and vertical columns enclosed in brackets. Element - each value in.
Pseudo-code. Pseudo-code Task 1 Preparation Use the following code to declare, initialise and populate an array in a new VB.NET console application:
Chapter 1 Computing Tools Variables, Scalars, and Arrays Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Advanced Excel Topics – Arrays
Some Matlab Tips CSE 4309 – Machine Learning Vassilis Athitsos
Variables on Both Sides with Equations
CSCI N207 Data Analysis Using Spreadsheet
Chapter2 Creating Arrays
2.2 Introduction to Matrices
Matrices.
Hint idea 2 Split into shorter tasks like this.
Working with Arrays in MATLAB
General Computer Science for Engineers CISC 106 Lecture 11
Presentation transcript:

ME 142 Engineering Computation I Using Excel Arrays in Functions

Key Concepts Using Excel Arrays in Functions

 Techniques used earlier in the class for matrices may also be used to pass array information to and from a function.  This effectively allows a function to return information to more than a single cell.

Using Excel Arrays in Functions Function AddVect(V1, V2) 'Adds two 2-dimensional vectors Dim AV(1 To 2) AV(1) = V1(1) + V2(1) AV(2) = V1(2) + V2(2) AddVect = AV End Function

Example Problem  Develop a function to subtract two 3- dimensional vectors

Example Problem Function VDiff(v1, v2) Dim Results(1 To 3) If v1.Count <> 3 Or v2.Count <> 3 Then MsgBox (“Error-each vector must contain 3 cells") Else For i = 1 To 3 Results(i) = v1(i) - v2(i) Next i VDiff = Results End If End Function

Tips for Using Excel Arrays in Functions Use one array variable for each vector Vector arrays are passed to function via argument list Do NOT dimension argument list variables May use.Count method to determine vector size Dim output array to store results DO dimension output array variable Set output array equal to function name to return results Select entire output area in spreadsheet before launching Use Ctrl+Shift+Enter

Homework Help ‘n Hints