Question: Matlab question 1.You are given a text file called Random_Data.txt. The very first line of the file contains only 1 number. This number indicates how

Matlab question 1.You are given a text file called "Random_Data.txt". The very first line of the file contains only 1 number. This number indicates how many vectors are stored in this file. Every vector in this file is 1 x 5. Write a script that will add up all of the vectors in this file and save your answer in a variable called "Total".

2.

This problem is a continuation of the previous problem. You will want to add up all of the vectors in the file called "Random_Data.txt", but in addition, you want to save all of the intermediate results. For example, once you add up the first two vectors, write the results into another text file called "Results.txt". The next line should have the intermediate answer of adding the previous result to the third vector, etc... Your Results.txt should contain vector_count - 1 vectors with the final vector being the final answer for adding all of the vectors up in the Random_Data.txt file.

Example:

Original File:

1 1 1 1 1

1 1 1 1 1

1 1 1 1 1

1 1 1 1 1

Results.txt

2 2 2 2 2

3 3 3 3 3

4 4 4 4 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!