ABCs_conditionals

# ABCs_conditionals - whether Y...

This preview shows page 1. Sign up to view the full content.

function [A B C D] = ABCs_conditionals(Z,Y,X) % ABCs of Cell Arrays % % This is a multi-part problem. Do each of the parts below. % % DO NOT CHANGE THE FUNCTION HEADER (the first line of code) % % a) IF statements. Z is a character. Fix the if statement below so that % it checks whether Z is an uppercase letter or a lowercase letter. If Z % is lowercase, set A to be the string 'lower'. Set A to 'upper' if Z is % uppercase. Set A to 'neither' if Z is not a letter. Replace every ? with % the necessary code. You MUST use the provided IF statement to receive % credit for this problem. % A = 'upper'; A = 'lower'; else A = 'neither'; end e % b) SWITCH statements. Y is a number between 0 and 10 inclusive and not % necesarily an integer. Fix the given switch statement so that it checks
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % whether Y is "odd", "even" or a "decimal". The switch should set B to % the string 'even','odd', or 'decimal' accordingly. Replace every ? with % the necessary code. You MUST use a SWITCH statement to receive credit % for this problem. switch mod(Y, 2) % change this line case 0 % change this line B = 'even'; case 1 % change this line B = 'odd'; otherwise B = 'decimal'; end e % c) any. X is a vector of logicals. Use the any( ) function to check if % any of the values of X is TRUE. Return a logical true or false % accordingly. Store your result in a variable named C. C = any(X);%fill in this line C % d) all. Use the all( ) function to check if all of the values of X % are TRUE. Return a logical true or false accordingly. Store your result % in a variable named D. D = all(X);%fill in this line...
View Full Document

## This note was uploaded on 10/22/2009 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Tech.

Ask a homework question - tutors are online