TAILIEUCHUNG - CRC.Press A Guide to MATLAB Object Oriented Programming May.2007 Episode 2 Part 7

Tham khảo tài liệu ' a guide to matlab object oriented programming episode 2 part 7', kỹ thuật - công nghệ, cơ khí - chế tạo máy phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 294 A Guide to MATLAB Object-Oriented Programming cShapeArray and numel The function numel should be in the same category as length size reshape and ndims however numel requires a separate section because it exhibits some unexpected behavior. The tailored version of numel doesn t always seem to be called at the right time. We can implement numel and demonstrate what happens. Implementing the tailored version follows easily from the previous section. The one-line command inside is num numel varargin First create a cShapeArray container with two shapes in it. This can be done using the following commands shape_array cShapeArray cStar cDiamond Next look at the result of dot-reference access once with and once without a container-specific version numel. On the disk the class that includes numel can be found in chapter_19 with_numel. If you are following along when you change between directories be sure to clear classes and recreate the container. The result with numel is ans normal ans normal and the result without numel is ans normal normal Differences are subtle but the result with numel included is correct. You should expect two answers because the length of shape_array is two. Somewhere behind the scenes MATLAB finds the correct value of nargout by calling numel. When the container class includes numel subsref and get receive the appropriate value for nargout. When the container class does not include numel the built-in version supplies the wrong value to nargout. Code inside get is trying to correct the mismatch by concatenating the LineWeight strings in a single cell array. If that was the end of the story it would be easy to say Let s overload numel. If that was the end of the story I wouldn t be putting you through all of this. Before we make a firm decision on numel let s look at an example of dot-reference mutation. Include a container-specific version of numel and see what happens for .

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.