Subscripted Reference for Structures

버전 1.2.0.0 (3.7 KB) 작성자: Brian Emery
Applies indexing to the fields of a structure.
다운로드 수: 270
업데이트 날짜: 2011/5/9

라이선스 보기

Applies indexing to the fields in a structure in much the same way as subsref.m works with matricies, vectors, etc. The indexing is only applied to fields with n columns (or rows).

Example call: S = subsref_struct(S,i,n,rc)

Applies the indexing given in i, to the fields in S that have the
matching number of columns (n). Given a 4th input will apply the indexing to the rows (1) or columns (2), defaults to columns.

Example:
Create a structure with mixed fields, array and structure
d.lon = ones(5,1)*[1:10];
d.lat = ones(5,1)*[1:10];
d.time = 1:10;
d.strct = d;

Change the column indexing
S = subsref_struct(d,2:5,size(d.lon,2),2)

Change the row indexing
S = subsref_struct(d,1:2,size(d.lon,1),1)

인용 양식

Brian Emery (2026). Subscripted Reference for Structures (https://kr.mathworks.com/matlabcentral/fileexchange/29003-subscripted-reference-for-structures), MATLAB Central File Exchange. 검색 날짜: .

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

Corrected error in example

1.1.0.0

Examples updated to correct error.

1.0.0.0