Question

Each group is required to choose ONE of the sets below. The chosen set must be...

Each group is required to choose ONE of the sets below. The chosen set must be different between the two groups.
Set A
Filename: A.txt
CID Graduates Employed
2419 2339 1976
2416 756 640
2415 856 648

Set B
matrix = [26518 100 2; 32185 58 1; 35689 42 1; 48613 172 3];
Employee ID Salary (thousand, $USD) Status
26518 100 2
32185 58 1
35689 42 1
48613 172 3

Complete the following:
1. [For Set A] Provide the syntax to extract the 2

nd row of numerical data (as highlighted) using

a. fopen, fgetl, close
b. importdata
[For Set B] The following code creates the data set, opens a file to export fprintf commands and closes the file.
matrix = [26518 100 2; 32185 58 1; 35689 42 1; 48613 172 3];
fid = fopen('export_file.txt','wt');
fprintf(fid,'%8s %8s %8s\n','ID','Salary','Status')
fprintf(fid,'%8.0f %8.0f %8.0f\n', matrix)
fclose(fid);
a. Provide the output of highlighted fprintf lines
2. Explain your illustrations to the other group on your table and discuss any misunderstandings
3. Take a photo of your work for future reference. The entire table is to present the work to a demonstrator and
answer questions to get it marked off before moving onto the next task.

Homework Answers

Answer #1

Solution:

Set A:

a) fopen, fgetl, close

% Open file
fileID = fopen('A.txt');

% Read header
lin = fgetl(fileID);
i=0;

% Extract 2nd numeric data
while i<2
    lin = fgetl(fileID);
    i=i+1;
end
fprintf(" The 2nd row of numeric data is %s\n",lin);

Output:

b. using importdata

% Open file
da=importdata('A.txt', ' ', 1);
% Print ouput
disp('2nd row of numeric data')
da.data(2,:)

Output:

Set B:

a.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
As part of the quarterly reviews, the manager of a retail store analyzes the quality of...
As part of the quarterly reviews, the manager of a retail store analyzes the quality of customer service based on the periodic customer satisfaction ratings (on a scale of 1 to 10 with 1 = Poor and 10 = Excellent). To understand the level of service quality, which includes the waiting times of the customers in the checkout section, he collected data on 100 customers who visited the store; see the attached Excel file: ServiceQuality. Using Data Mining > Cluster,...
Historically, the MBA program at Whatsamattu U. has about 40% of their students choose a Leadership...
Historically, the MBA program at Whatsamattu U. has about 40% of their students choose a Leadership major, 30% choose a Finance major, 20% choose a Marketing major, and 10% choose no major. Does the most recent class of 200 MBA students fit that same pattern or has there been a shift in the choice of majors. Using the sample of 200 students (in the data file), conduct a Chi Square Goodness of Fit test to determine if the current distribution...
Bivariate Data & Probability After completing the calculation by hand in Q1 you can use Excel...
Bivariate Data & Probability After completing the calculation by hand in Q1 you can use Excel to check your answers before submitting. Q2 assesses your general understanding of probability and linear associations using Excel to analyse a large dataset. Question 1       Covariance and Correlation The table below shows a set of sample bivariate data. Calculate the covariance and correlation coefficient by completing the below table. Show all working. X Y (X - ) (Y - ) (X - )(Y -...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT