How can I create a function to access substructure values?
이전 댓글 표시

I'd like to write a function which can access the values of a substructure. For example, if I have structure (USA), containing another (states) then values within that substructure, I know I could access the GDP of the state PA through:
USA.PA.GDP
How can I create a generic function, GetGDP so that I can get the same result by
GetGDP(PA).
Similarly, I could enter any state (i.i MD or CA) and return the GDP of that given state.
This is a simplified example of a more complex system, but this is the fundamental challenge I am facing
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Specialized Power Systems에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!