# subdict

Extract submatrix from a sensing dictionary

Since R2022a

## Syntax

``Ar = subdict(A,rowIndices,colIndices)``

## Description

example

````Ar = subdict(A,rowIndices,colIndices)` returns the submatrix `Ar` that corresponds to the rows and columns specified by `rowIndices` and `colIndices`, respectively.```

## Examples

collapse all

Create a sensing dictionary. Set the type of the sensing dictionary to `'fourier'` and `'eye'`. The size of each basis type is 100-by-100.

`A = sensingDictionary(Size=100,Type={'fourier','eye'})`
```A = sensingDictionary with properties: Type: {'fourier' 'eye'} Name: {'' ''} Level: [0 0] CustomDictionary: [] Size: [100 200] ```

Extract the entire submatrix that is associated with the `'eye'` basis type. Visualize the submatrix.

```Bmat = subdict(A,1:100,101:200); imagesc(Bmat)```

Extract a 25-by-50 submatrix associated with the `'fourier'` basis type. Visualize the real and imaginary parts of the submatrix.

```Cmat = subdict(A,1:25,1:50); subplot(1,2,1) imagesc(real(Cmat)) title("Real Part") subplot(1,2,2) imagesc(imag(Cmat)) title("Imaginary Part")```

## Input Arguments

collapse all

Sensing dictionary, specified as a `sensingDictionary` object.

Row indices to extract, specified as a vector.

Example: `Ar = subdict(A,1:256,1:100)` returns the 256-by-100 submatrix that corresponds to the rows indexed by `1:256` and columns indexed by `[1:100]`.

Data Types: `double`

Column indices to extract, specified as a vector.

Example: `Ar = subdict(A,1:128,[2 3 5 8 13])` returns the 128-by-5 submatrix that corresponds to the rows indexed by `1:128` and columns indexed by `[2 3 5 8 13]`.

Data Types: `double`

## Output Arguments

collapse all

Submatrix extracted from the `sensingDictionary` `A`, returned as a matrix. The matrix `Ar` is M-by-N, where M equals the length of `rowIndices`, and N equals the length of `colIndices`.

Data Types: `double`

## Version History

Introduced in R2022a