Solve a programming problem, MATLAB Programming

Write a function rid_multiple_blanks that will receive a string as an input argument. The string contains a sentence that may have multiple blank spaces in between some of the words. The function will return the string with only one blank in between words. For example,

>> mystr = 'Hello and how are you?';
>> rid_multiple_blanks(mystr)
ans =
Hello and how are you?

Save the function in a Matlab ".m" file and test it with several different input strings in the command window.

In this question we will practice using Matlab structures. In your script, which should be called ‘yourname_lab5_2.m', you need to create a vector of structures to represent some student quiz data.

Quiz data for a class is stored in a file called ‘studentinfo.dat'. Each line in the file has the student ID number (which is an integer) followed by the quiz scores for that student. For example, if there are four students and three quizzes for each, the file might look like this:

44 7 7.5 8
33 5.5 6 6.5
37 8 8 8
24 6 7 8

In the script load the data into a vector of structures. Each structure represents one student and has two fields: ‘id-no' for the integer student ID number and ‘quiz' as a vector of quiz scores. Graphically the structure will look like this:

To accomplish this, first use the load function to read all information from the file into a matrix. Then, using a loop, copy the data into a vector of structures as specified previously. Then, the script will calculate and print the quiz average for each student; for example, if the file is as just shown:

Student Quiz Ave

44 7.50
33 6.00
37 8.00
24 7.00

3. Start and Stop Codon

In nature the translation from the mRNA to the protein sequence always begins at a start codon (AUG) and ends at one of the stop codon (UAA, UGA and UAG) . Nucleotide bases before the start codon are not translated. In this question, we want to remove the bases before the first start codon in an mRNA sequence and translate the remaining bases into a protein sequence.

a) Create a function called remove_to_start that takes as input a string and returns a new string with everything prior to the first start codon removed.

For example:
>> s1 = 'AAACCCAUGCCCUAA'
>> s1_trim = remove _to_start(s1)

s1_trim =
AUGCCCUAA

Posted Date: 3/13/2013 5:16:39 AM | Location : United States







Related Discussions:- Solve a programming problem, Assignment Help, Ask Question on Solve a programming problem, Get Answer, Expert's Help, Solve a programming problem Discussions

Write discussion on Solve a programming problem
Your posts are moderated
Related Questions
La proporción de empleados de una empresa que usan su auto para ir al trabajo es 5:16. Si hay un total de 800 empleados

Expressions: The Expressions can be formed using values, variables which have already been formed, operators, parentheses, and built-in functions. For numbers, these can invol

1. Assume that there exists a surface that can be modeled with the equation:  z = e-(x 2 + y 2 ).  a) Calculate ∇z at the point (x = 0, y = 0). b) In addition, use MATLAB to

i need matlab code on 2 dimensional analysis of temperature distribution in steel using finite element method

Show (turn in) similar output images as in part 2 for each of your new images (there is only 1 connected component in this case). Write three functions which compute the moments, c


Problem of a projectile being launched at an angle of O at an initial velocity ofv. The equations for the height hand horizontallocation x as functions of time t are as follo

Your Task: Write an M-function that computes simple returns as formula (1). Use this function to calculate the daily returns for each index. Using MATLAB build-in functions estimat

Consider the shaft-rotor system shown in Figure. Write down the equations of motion. Taking  I= 1 kgm 2 and k=10 kNm/rad, for two special cases (α =0.5 and α = 1000) find as many

Common form of a function definition: The common form of a function definition for a function which computes and returns one value looks like this: For illustration, t