Main Content

stripdims

Remove dlarray data format

Description

example

dlY = stripdims(dlX) returns the dlarray dlX without any dimension labels. dlY is an unformatted dlarray.

Examples

collapse all

Create a formatted dlarray.

dlX = dlarray(randn(3,2,1,2),'SSTU')
dlX = 
  3(S) x 2(S) x 1(T) x 2(U) dlarray


(:,:,1,1) =

    0.5377    0.8622
    1.8339    0.3188
   -2.2588   -1.3077


(:,:,1,2) =

   -0.4336    2.7694
    0.3426   -1.3499
    3.5784    3.0349

Create an array that is the same as dlX but has no dimension labels.

y = stripdims(dlX)
y = 
  3x2x1x2 dlarray


(:,:,1,1) =

    0.5377    0.8622
    1.8339    0.3188
   -2.2588   -1.3077


(:,:,1,2) =

   -0.4336    2.7694
    0.3426   -1.3499
    3.5784    3.0349

Input Arguments

collapse all

Input dlarray, specified as a dlarray object.

Example: dlX = dlarray(randn(3,4),'ST')

Output Arguments

collapse all

Unformatted dlarray, returned as an unformatted dlarray object that is the same as the input array dlX, but without any dimension labels. If dlX is unformatted, then dlY = dlX.

Tips

  • Use stripdims to ensure that a dlarray behaves like a numeric array of the same size, without any special behavior due to dimension labels.

  • ndims(dlX) can decrease after a stripdims call because the function removes trailing singleton dimensions.

    dlX = dlarray(ones(3,2), 'SCB');
    ndims(dlX)
    ans =
    
         3
    dlX = stripdims(dlX);
    ndims(dlX)
    ans =
    
         2

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

See Also

| |

Introduced in R2019b