Given an array, first create a new row on the bottom that represents the sum of each column. Then add a new column on the right that represents the average of each row arri = [1 2; 3 4]; out1 = addInfo(arr1) out1 = 1.0000 2.0000 1.5000 3.0000 4.0000 3.5000 4.0000 6.0000 5.0000 arr2 = [3 2 8 4; 2 8 9 1; 9 8 2 1; 10 20 30 4]; out2 = addInfo(arr2) out2 = 3.0000 2.0000 8.0000 4.0000 4.2500 2.0000 8.0000 9.0000 1.0000 5.0000 9.0000 8.0000 2.0000 1.0000 5.0000 10.0000 20.0000 30.0000 4.0000 16.0000 24.0000 38.0000 49.0000 10.0000 30.2500

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter6: Using Arrays
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Question

Write the matlab code. 2 input example are shown here. 

Descipuon:
Given an array, first create a new row on the bottom that represents the sum of each column. Then add a new column on the right that represents the average of each row
[1 2; 3 4];
out1 = addInfo(arr1)
arri =
out1 =
1.0000
2.0000
1.5000
3.0000
4.0000
3.5000
4.0000
6.0000
5.0000
arr2 = [3 2 8 4; 2 8 9 1; 9 8 2 1; 10 20 30 4];
out2 -
addInfo(arr2)
out2 =
3.0000
2.0000
8.0000
4.0000
4.2500
2.0000
8.0000
9.0000
1.0000
5.0000
9.0000
8.0000
2.0000
1.0000
5.0000
10.0000
20.0000
30.0000
4.0000
16.0000
24.0000
38.0000
49.0000
10.0000
30.2500
Transcribed Image Text:Descipuon: Given an array, first create a new row on the bottom that represents the sum of each column. Then add a new column on the right that represents the average of each row [1 2; 3 4]; out1 = addInfo(arr1) arri = out1 = 1.0000 2.0000 1.5000 3.0000 4.0000 3.5000 4.0000 6.0000 5.0000 arr2 = [3 2 8 4; 2 8 9 1; 9 8 2 1; 10 20 30 4]; out2 - addInfo(arr2) out2 = 3.0000 2.0000 8.0000 4.0000 4.2500 2.0000 8.0000 9.0000 1.0000 5.0000 9.0000 8.0000 2.0000 1.0000 5.0000 10.0000 20.0000 30.0000 4.0000 16.0000 24.0000 38.0000 49.0000 10.0000 30.2500
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr