Assignment 8 Read from a file Problem Description You are gi

Assignment 8 Read from a file Problem Description 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\". Solution MATLAB Documentation 1 %Write the code to complete this solution here . This should be a script and not a function.

Solution

f1=fopen(\'Random_Data.txt\', \'r\');

t1 = fgets(f1);
c = textscan(t1,\'%d\');
n = c{1};
Total = [0 0 0 0 0];
for i = 1:n
A = fscanf(f1,\'%d\',5);
A = A\';
%disp(A);
Total = Total + A;   
end

%disp(Total);

 Assignment 8 Read from a file Problem Description You are given a text file called \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site