| Term 
 
        | The sum of the values in vector grades (use built-in function). |  | Definition 
 | 
        |  | 
        
        | Term 
 
        | The average of the values in vector grades (use built-in MATLAB function). |  | Definition 
 | 
        |  | 
        
        | Term 
 
        | The dimensions of matrix M. |  | Definition 
 | 
        |  | 
        
        | Term 
 
        | The submatrix of M consisting of (all rows and) Columns 10 through 15. |  | Definition 
 | 
        |  | 
        
        | Term 
 
        | a) Convert ASCII value in variable ASCIIvalue to character. |  | Definition 
 | 
        |  | 
        
        | Term 
 
        | Convert character value in variable AChar to ASCII. |  | Definition 
 | 
        |  | 
        
        | Term 
 
        | The number of occurrences of a letter (either uppercase or lowercase) in the variable AString. |  | Definition 
 | 
        |  | 
        
        | Term 
 
        | Removes the blanks from the end of the string city (and reassigns to city) |  | Definition 
 | 
        |  | 
        
        | Term 
 
        | Finds all occurrences of the substring cs112 in AString. |  | Definition 
 | 
        |  | 
        
        | Term 
 
        | Draw a rectangular box colored red joining the four points (-5,-5), (10,-5), (10,10),(-5,10). |  | Definition 
 
        | plot([-5,10,10,-5,-5],[-5,-5,10,10,-5],'r') |  | 
        |  | 
        
        | Term 
 
        | Reset axes so that there is a border of 2 units around box |  | Definition 
 | 
        |  | 
        
        | Term 
 
        | Assign customer a structure with fields first, last, id and balance, having values Joe Doe 678 and 104.87. |  | Definition 
 
        | customer = struct('first','doe','last','joe','id',678,'balance',104.87) |  | 
        |  | 
        
        | Term 
 
        | . The variable name consists of first name followed by a space followed by the last name.  Reassign name so that if consists of the last name followed by a comma, followed by a space, followed by the first name, e.g., Before:  name = Joe Doe
 After:  name = Doe, Joe
 |  | Definition 
 
        | [first last] = strtok(name); last = last(2:end);
 name = [last, ', ',first];
 |  | 
        |  | 
        
        | Term 
 
        | record is a structure with fields    first, last, id and balance,  storing a customer’s first name, last name, id number and balance.  Print last name followed by a comma, followed by first name. Print ID before id number.  Also, use dollar sign and print only 2 decimal points to the right of the balance, e.g., 
 Doe, Joe ID567 $108.23
 |  | Definition 
 
        | fprintf('%s, %s ID%d $%.2f',record.last,record.first,record.id,record.balance) |  | 
        |  | 
        
        | Term 
 
        | Repeat previous question, but store in the variable string customer instead of printing. |  | Definition 
 
        | costumer = sprintf('%s, %s ID%d $%.2f',record.last,record.first,record.id,record.balance) |  | 
        |  | 
        
        | Term 
 
        | Write a function getinput that keep asking the user for input until the user enter a value between 1 and 10 and returns the value input by the user.   Use prompt, Please enter a value between 1 and 10:
 |  | Definition 
 
        | function value = getinput %input a number between 1 and 10
 value = 0;
 while ~ismember(value,1:10)
 value = input('Please enter a value between 1 and 10:  ');
 end % while loop
 end %function value
 |  | 
        |  | 
        
        | Term 
 
        | Write a function flipcoin(p) that flips a coin where an outcome of head has probability p (and an outcome of tail has probability 1 – p).   The function should return the value 1 if the outcome is a head and the value 0 otherwise (if it’s a tail). |  | Definition 
 
        | function flip = flipcoin(p) %flips a coin with probability p of a head
 flip = rand < p;
 end %function flip
 |  | 
        |  | 
        
        | Term 
 
        | Write a function Strength(Value) that returns  the string values  Low, Medium Low, Medium, Medium High, High, depending on whether Value has the value 0, 1, 2, 3, 4, respectively. |  | Definition 
 
        | function s = strength(value) %returns string Low, Medium Low, Medium, Medium High, High, depending on whether
 %Value has the value 0, 1, 2, 3, 4, respectively.
 switch value
 case 0
 s = 'Low';
 case 1
 s = 'Medium Low';
 case 2
 s = 'Medium';
 case 3
 s = 'Medium High';
 case 4
 s = 'High';
 end %switch
 end %function strength
 |  | 
        |  |