tailieunhanh - A Guide to MATLAB Object-Oriented Programming phần 5

Việc thực hiện cuối cùng phụ thuộc vào lần đầu tiên phát triển một số nhóm tám thành viên khác. subsref Dot-tham khảo, Cố gắng 1 Một giải pháp tiềm năng để thách thức subsref được hiển thị trong 13 Mã. Giải pháp này là tương tự như giải pháp | Drawing a Shape 127 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 varargout else varargout end case ColorRgb if isempty this varargout else rgb hsv2rgb varargout mat2cell rgb 3 ones 1 size rgb 2 end case Points if isempty this varargout else varargout end otherwise found false didn t find it in the public section end concealed member variables not strictly public if found called_by_name found true switch index 1 .subs case mDisplayFunc if isempty this varargout else varargout end otherwise found false didn t find it in the special section end end if found error Reference to non-existent field index 1 .subs . end if length varargout 1 nargout 1 if iscellstr varargout any cellfun isempty varargout varargout varargout else 128 A Guide to MATLAB Object-Oriented Programming 70 71 try varargout varargout 72 73 74 75 76 catch varargout varargout end end end an empty object line 39 returns nothing. For a nonempty object line 41 packs each object s mPoints array into a separate cell and returns them to the caller. Modify set The modified version of set is shown in Code Listing 56. The changes to set are more extensive compared to those for get because the figure window only changes when member variables are changed. The biggest change occurs in lines 75-93 where the new Points public variable is implemented. Line 77 throws an error when indexing deeper than the first dot-reference level is detected. This is different from what we have done in the past and it incrementally moves the class interface away from the look and feel of a structure. Later if we decide to support individual element mutation that code would replace the error message. Lines 79-83 check the size of each input array. If the first dimension is not two an error is thrown. If the input sizes are okay line 84 deals the input arrays into mPoints. Finally lines

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã 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.