TAILIEUCHUNG - Lecture Data visualization - Chapter 27

The main contents of the chapter consist of the following: Function M-files, syntax of function M-Files, comments, multiple input and output functions, relational model concepts, relational model constraints and relational database schemas, update operations and dealing with constraint violations. | Lecture 27 Recap Function M-files Syntax of Function M-Files Comments Multiple Input and Output Functions Functions with No Input or No Output Although most functions need at least one input and return at least one output value, in some situations no inputs or outputs are required For example: consider this function, which draws a star in polar coordinates: function [] = star( ) theta = pi/2:*pi:*pi; r = ones(1,6); polar(theta,r) The square brackets on the first line indicate that the output of the function is an empty matrix (., no value is returned) The empty parentheses tell us that no input is expected If, from the command window, you type star then no values are returned, but a figure window opens showing a star drawn in polar coordinates Continued . There are numerous built-in MATLAB functions that do not require any input. For example: A = clock returns the current time: A = * Columns 1 through 4 Columns 5 through 6 Also, A = pi returns the value of the mathematical constant p: A = However, if we try to set the MATLAB function tic equal to a variable name, an error statement is generated, because tic does not return an output value: A = tic ???Error using ==> tic Too many output arguments The tic function starts a timer going for later use in the toc function Determining the Number of Input and Output Arguments There may be times when you want to know the number of input arguments or output values associated with a function MATLAB provides two built-in functions for this purpose The nargin function determines the number of input arguments in either a user-defined function or a built-in function The name of the function must be specified as a string, as, for example: in nargin('sin') ans =1 The remainder function, rem , requires two inputs; thus, nargin('rem') ans =2 Continued . When nargin is used inside a user-defined function, it determines how many input arguments were actually entered This

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.