Set and get nested Structure/Object filed data

버전 1.1.0.0 (1.54 MB) 작성자: Nikolay S.
Functions allowing easy Get & Set access to a nested Structure/Object filed data
다운로드 수: 93
업데이트 날짜: 2016/7/31

라이선스 보기

Ever worked with a Structure or an Object with complicated topology, including multi level nested fields? To access the relevant filed you must know the whole path. Luckily Matlab auto-completion is of a great help, but the problem still exists.
The code using this whole path may look like a sentence in literature. And what if the topology (full-path to the target field) will change? The support and debugging of such a code is a continuous nightmare. The following set of functions proposed a way out of this mess.
By using only a part of the path (possibly using only the target filed name) to your target sub-field, you can find the whole path using the function "isSubPath". It will verify whether the supplied partial path is legal, and returns the full-path. By using the full-path you can GETthe target field data, using the "getStructSubField" function with only two inputs- the structure and the full-path. In a similar manner you can SET the desired data to the target-field using the "setStructSubField" function.
Using the above sequence you will get short code, that will run, despite changes in topology (as long as the partial path is legal).
Me and my colleagues find this code very helpful. Hope you'll enjoy it as well.

인용 양식

Nikolay S. (2024). Set and get nested Structure/Object filed data (https://www.mathworks.com/matlabcentral/fileexchange/57957-set-and-get-nested-structure-object-filed-data), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2015a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.1.0.0

Fixed a few bugs, and rewritten some ionternal functions

1.0.0.0

Image added