Practice Quiz # 9 (With Solutions)

Use for conditional loops body will continue to get

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Useful commands: for i = 1:n ... end while <test> ... end break return length If <test> ... elseif <test> ... else ... end size numel mod floor ceil ischar isempty isstrprop lower upper num2str str2double strfind strrep strcmp strcmpi strcmpn strtok eval Allowed Looping Commands Use for counted loops, body will get executed 'n' times. Use for conditional loops, body will continue to get executed as long as the test is true Jumps out of current loop (execution resumes at next line of code after current loop) returns from current function immediately Get the length of the longest dimension of a vector or array Conditional logic is allowed Returns a vector containing the size of each dimension in a vector or array Get the total count of elements in a vector or array modulus after division (e.g., mod(9,4) is 1, because 5/4=2+1/4) Truncates number to the next lower whole integer Increases number to the next higher whole integer String Functions Tests whether a character or string is of data type 'char' Tests whether an array is empty Tests each character in a string for membership in various groups (alphabet, digit, alphanumeric, lower, upper, punctuation, control, graphic, printable, white space, etc.) Returns a logical array of true/false values Converts all characters in a string to lowercase Converts all characters in a string to uppercase Converts a number into a 'string Converts a 'string' into a number Find any instances of a query string inside another typically larger search string Returns indices to each valid instance of the query string inside the search string Replace all instances of a query string with a replacement string inside of a typically larger search string. Compare 2 strings for equality (returns true/false) Compare 2 strings for equality, case insensitive (IE 'a' == 'A') Compare 2 strings for equality, compares only up to the first 'n' characters in each string Breaks string into 2 pieces [token, restOfString] around a delimiter character, the delimiter defaults to the space character if not specified. Executes a string as if it was a MATLAB expression that you had typed yourself at the command line prompt....
View Full Document

Ask a homework question - tutors are online