TAILIEUCHUNG - matlab primer 7th edition phần 3

mà có thể được sử dụng từ MATLAB hoặc từ một ứng dụng C độc lập, mà không có MATLAB. Trong ví dụ trong phần tiếp theo, các vĩ mô INDEX giúp với bản dịch này. Chỉ số của mảng cũng xuất hiện khác nhau. MATLAB được viết bằng C, và nó lưu trữ tất cả của mảng nội bộ bằng cách sử dụng số không dựa trên lập chỉ mục. | continue statement. Here is an example for both. It prints the odd integers from 1 to 7 by skipping over the even iterations and then terminates the loop when i is 7. for i _ 1 10 if mod i 2 0 continue end i _ if i 7 break end end The if statement The general form of a simple if statement is if expression statements end The statements will be executed only if the expression is true. Multiple conditions also possible for n -2 5 if n 0 parity 0 else if rem n 2 0 parity 2 else parity 1 end disp n parity end The else and elseif are optional. If the else part is used it must come last. 32 The switch statement The switch statement is just like the if statement. If you have one expression that you want to compare against several others then a switch statement can be more concise than the corresponding if statement. See help switch for more information. The try catch statement Matrix computations can fail because of characteristics of the matrices that are hard to determine before doing the computation. If the failure is severe your script or function see Chapter 7 may be terminated. The try catch statement allows you to compute optimistically and then recover if those computations fail. The general form is try J statements catch statements end The first block of statements is executed. If an error occurs those statements are terminated and the second block of statements is executed. You cannot do this with an if statement. See doc try. See Section for an example of try and catch. Matrix expressions if and while A matrix expression is interpreted by if and while to be true if every entry of the matrix expression is nonzero. Enter these two matrices A 1 2 3 4 B 2 3 3 5 33 If you wish to execute a statement when matrices A and B are equal you could type if A B disp A and B are equal end If you wish to execute a statement when A and B are not equal you would type if any any A B diSp A and B are not equal end or more simply if A B else disp A and B are not

TỪ KHÓA LIÊN QUAN
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.