Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
MTM[subsref] - subscript reference of arrays
Calling Sequence
subsref(A,index)
Parameters
A
-
array or record
index
record, list, or array
Description
The subsref command mirrors subscript referencing in MATLAB. Using A(index) in MATLAB will produce the same result as subsref(A,index) indices.
In Maple, indexing is usually done using square brackets, as in A[i,j,k]. For an n-dimensional Array, A, you must specify n values. subsref allows you to provide fewer than n values, in which case the Array is indexed as if it only had that number of dimensions, with the last dimension being the size of the product of all remaining dimensions.
For example subsref(A,[i]) can be used to index into an m x n Array. In this case for the purpose of indexing, A is considered to be a 1D array of size mn in Fortran_order.
The specified index for any dimension can be an array itself. In this case, multiple values will be fetched from A. An array will be returned.
More complicated indexing, such as A(index1).index2(index3) require the use of a Record or array of Records with "type" and "subs" fields to specify the subreference for each indexing operation. The "type" field can have the values "()", "{}", or ".". There is no distinction between the first two, "()" and "{}", which indicate array-indexing. The "." type indicates an index into a Record. The "subs" field contains the actual index value. For example A(i,j) can be looked up via subsref(A,Record(type="()",subs=Array([i,j]))); Similarly A(i,j).name is accessible via subsref(A,< Record(type="()",subs=Array([i,j])) Record(type=".",subs="name") > );.
Examples
See Also
Fortran_order, MTM[subsasgn], Record
Download Help Document