Tham khảo tài liệu ' a guide to matlab object oriented programming episode 1 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ả | 94 A Guide to MATLAB Object-Oriented Programming INDEPENDENT INVESTIGATIONS 1. In the -full case use class to inspect and assign the field s type. What are you going to do for object arrays 2. Modify to take advantage of fieldnames. 7 In the previous chapter we patched a hole in MATLAB s default encapsulation by tailoring fieldnames. In this chapter we patch another hole by tailoring struct. As we have already seen the built-in version of struct returns the names and values of private member variables. In fact struct s default behavior represents a risky situation because clients can use it to gain access to private data. We need to eliminate this possibility by developing a type-specific version of . As a bonus a standard function that returns an object s public structure is broadly useful. For example look back at the scalar case of the tailored version of display. The strategy of allowing MATLAB to perform most of the formatting requires a structure of public variables. At that time public structure generation was coded directly in line and we could not easily make use of it in developer view. Further proliferation of in-line structure-generation code makes class extensions very tedious and error prone. Consolidating structure generation into one function makes a lot of sense. We can even take advantage of the tailored version of fieldnames so that even public names are not directly coded into struct. STRUCT While we could easily write a specific get function for this task . getPublicStructure MATLAB already defines a suitable function. The built-in version of struct already returns a structure associated with the object. The built-in version will also operate on objects. Unlike the help for fieldnames help struct does not promise to return a structure of public data fields. The help files for struct describe a function that converts an object into its equivalent structure. Here our idea of equivalent structure and MATLAB s