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
Assume that ip has been declared to be a pointer to int and that result has been declared to be an array of 100 elements . Assum
Bogdan [553]

Answer:

The expression of this question can be given as:

Expression:

*ip + 1

Explanation:

In this question, it is given that ip variable has been declared and initialized and the ip variable is in the first half of the array. It finds the expression whose value is after the element of the array that ip points. So the expression to this question is *ip + 1. Where * is used to define ip variable as a pointer and its value is increased by 1 that is given in the question.

7 0
3 years ago
Why is art important to heritage?
Sophie [7]
<span>but of culture, values and traditions. Cultura</span>
7 0
3 years ago
Which of the following is true about algorithms?
Artist 52 [7]

Answer:

C

Explanation:

A is false because they usually <em>are</em> used to solve problems

B is false because many different algorithms can solve a problem!

C - true

D is false because humans can write an algorithm.  

8 0
3 years ago
Which of the following refers to the bottom pane of the Wireshark window where all of the information in the packet is displayed
Lorico [155]

Answer:

D) Hex Pane.

Explanation:

Hex Pane  is the bottom pane where whole information in the packet is shown in hexadecimal format on the left and also in character when possible and decimal also.It is the bottom pane of Wireshark window.

So we can say that Hex pane is referred to the bottom pane of the Wireshark window which displays the information in hexadecimal on the left .

5 0
2 years ago
In Microsoft Word, when you highlight existing text you want to replace, you are in
kirill115 [55]
The correct answer is C. Typeover mode

This is when you select a text and can then type over it and it automatically replaces it with what you're writing. It also creates a little box that lets you edit the selected part easily if that's what you need with things like bold or italic or change the text color.
6 0
3 years ago
Other questions:
  • What is a database query?
    12·2 answers
  • Tell me the shortcut keys used in Ms PowerPoint ?​
    6·2 answers
  • list the version of Windows you are using XP, Windows7, Windows8 and then explain the steps you will use to find the programs
    6·1 answer
  • If you create and invoke a recursive function without accounting for a base case, what can go wrong?
    15·1 answer
  • Assign a variable solveEquation with a function expression that has three parameters (x, y, and z) and returns the result of eva
    6·1 answer
  • Big data refers to huge collections of data that are difficult to process, analyze, and manage using conventional data tools. It
    13·1 answer
  • Write a program that echos back any inputted integer greater than 1, and exits when a 0 is entered. Your program should use a co
    11·1 answer
  • What to do when you accidentally delete usb drivers?
    8·1 answer
  • What are the vitamins used for DNA Synthesis and Repair?​
    11·1 answer
  • Following Aristotle,man by nature is a political animal,justify the above claim in the light of the Russian invasion of Ukraine
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!