I am working on 5D matrix configured as follow :

```
[nf,nx,ny,np,nz]=size(D);
```

such

```
nf=301;
nx=12;
ny=12;
np=12;
nz=12;
```

I need to extract two matrices from this 5D matrix D :

- The first
`A`

, such`[nf,nx,ny]=size(A);`

- The second
`B`

, such`[nf,np,nz]=size(B);`

Is there any MATLAB codes to extract these two matrices from `D`

?