1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kirill115 [55]
3 years ago
14

Given an input array of strings (characters) s, pick out the second column of data and convert it into a column vector of data.

Missing data will be indicated by the number 9999. If you encounter missing data, you should set it to the average of the immediately neighboring values. (This is a bit simpler than using `interp1`.)
If the input array is s = [ 'A' '0096' ; 'B' '0114' ; 'C' '9999' ; 'D' '0105' ; 'E' '0112' ]; then the output variable `t` is the following column vector. t = [96 114 109.5 105 112]';
Compose a function read_and_interp which accepts an array in the above format and returns the data converted as specified. You may find the conversion function `str2num` to be useful.
(Using MATLAB Syntax only)
Computers and Technology
1 answer:
hodyreva [135]3 years ago
7 0

Answer:

Consider the following code.

Explanation:

save the following code in read_and_interp.m

 

function X = read_and_interp(s)

[m, n] = size(s);

X = zeros(m, 1);

for i = 1:m

if(str2num(s(i, 2:5)) == 9999)

% compute value based on previous and next entries in s array

% s(i, 2:5) retrieves columns 2-5 in ith row

X(i,1) = (str2num(s(i-1 ,2:5)) + str2num(s(i+1,2:5)))/2;

else

X(i,1) = str2num(s(i,2:5));

end

end

end

======================

Now you can use teh function as shown below

s = [ 'A' '0096' ; 'B' '0114' ; 'C' '9999' ; 'D' '0105' ; 'E' '0112' ];

read_and_interp(s)

output

ans =

96.000

114.000

109.500

105.000

112.000

You might be interested in
Notes on secondary memory​
gladu [14]

Answer:

non-volatile and persistent in nature

7 0
3 years ago
A company asked you help mitigate the brute force attacks carried out against its users' Windows account passwords. You successf
alexdok [17]

Answer:

a. Require user account passwords

e. Set failed logon restrictions

b. Require strong passwords

Explanation:

3 0
3 years ago
Ladders are a fundamental piece of equipment on construction sites and employers are expected to ensure that workers follow safe
Ede4ka [16]
That statement is true.

Ladders commonly used to do a couple of construction activities in a higher region of a building or area.
If this equipment is not used properly, it could potentially caused  fatal accidents for the people on the site
6 0
3 years ago
This sensor is used for burglar alarms<br>A. temperature<br>b. humidity<br>c. movement<br>d. PH​
bogdanovich [222]

Answer:

C

Explanation:

Have a great summer :)

8 0
3 years ago
What are the advantage of an e-library​
Semmy [17]

Answer:

Makes it easier to read... summarize cite electronic versions of editions

3 0
1 year ago
Other questions:
  • These devices: monitor, earphone, speakers are examples of what? Input devices Storage devices Output devices All answer are cor
    10·2 answers
  • Which type of drawer has three dispensing modes: single-dose, multi-dose, and matrix?
    13·1 answer
  • Unlike memory, this type of storage holds data and programs even after electrical power to the computer system has been turned o
    10·1 answer
  • A(n) __ is a list of main points and sub-points of a topic to include in a presentation
    14·2 answers
  • Is amazon a e-commerce website <br> o true <br> o false
    8·2 answers
  • What is the definition of trouble shooting.
    12·1 answer
  • 80. A .......... is used to read or write data.<br>A. CD B. VDU C. ROM D. RAM​
    6·1 answer
  • Why does this website have so many copies of plagiarism?
    5·1 answer
  • The ability to use various design software such as Adobe Photoshop, InDesign, and Illustrator would be MOST beneficial to which
    6·1 answer
  • Functions are used to _________
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!