Main Content

parentheses, ( )

Command grouping, indexing

Syntax

Description

Parentheses () specify order of operations, perform indexing, and enclose function and method input arguments. For instance, (A.*(B./C)) uses parentheses to specify order of operations.

example

Examples

expand all

Use parentheses to explicitly specify order of operations in long or complicated expressions.

a = 5;
b = 4;
c = 8;
d = 2;

(a.*(b+c))./d
ans = 
30

Create a matrix and index the first element, first row, and first column.

A = [10 1 1; 1 10 1; 1 1 10]
A = 3×3

    10     1     1
     1    10     1
     1     1    10

A(1,1)
ans = 
10
A(1,:)
ans = 1×3

    10     1     1

A(:,1)
ans = 3×1

    10
     1
     1

Version History

Introduced before R2006a