Q:

Write a function allparts that will read in lists of part numbers for parts produced by two factories. These are contained in data files called xyparts.dat and qzparts.dat

0

Write a function allparts that will read in lists of part numbers for 

parts produced by two factories. These are contained in data files 

called xyparts.dat and qzparts.dat. The function will return a vector of 

all parts produced, in sorted order (with no repeats). For example, if 

the file xyparts.dat contains

123 145 111 333 456 102

and the file qzparts.dat contains

876 333 102 456 903 111

calling the function would return the following:

>> partslist = allparts

partslist =

 102 111 123 145 333 456 876 903

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

allparts.m

function outvec = allparts

% Reads in parts list from 2 data files

% Format of call: allparts or allparts()

% Returns a sorted list of all factory parts

load xyparts.dat

load qzparts.dat

outvec = union(xyparts,qzparts);

end

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now