ENGR 101 Lecture Notes - Lecture 3: Text Editor, Matlab

17 views3 pages
24 Jan 2017
School
Department
Course

Document Summary

We will cover three different types of selection in matlab: if/elseif/else - only evaluated if the expressions before them are false. Matlab also has a switch construct for cases in which you are choosing from a number of alternatives. Given as a shorter way of doing a certain type of selection. When you have a number of alternatives for a specific variable statement 1 statement 2 switch (switch_expr) case case_expr_1 case case_expr_2 otherwise end statement 3 statement 4 statement 5. Catch block - list of statements that comes after a catch statement. Useful for running code that might have errors in it. Statement 2 try catch end if the user inputs a value that does not work with your code. Statement 4 a = [2 5 7 10] try catch end i = input( enter a subscript"); disp ([ value at in2str(i) = num2str(a(i))]); disp([ out of range:" int2str(i)]); Matlab can store function definitions in an internal format called pcode.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents