You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: partial_FDCT.m
    path of file: ./repos/CS_MoCo_LAB/reconstruction/matlab/CS_LAB_matlab/utils/utils_TRAFO/CurveLab-2.1.3
    
    the code of the file until where you have to start completion: function [X, meta] = partial_FDCT(x, is_real, finest, nbscales, nbangles_coarse)
%Apply a forward fast discrete curvelet transformation to x.
%The input image is of the size MxN
%The resulting pyramidial structure of the curvelet coefficients is sorted by size
%and truncated to the size MN. This way, the transformed image X and the original image x
%have same size. The original pyramidial structure will be reconstructed while the iFDCT is performed, filling
%neglected coefficients with 0.

    
function [X, meta] = partial_FDCT(x, is_real, finest, nbscales, nbangles_coarse)
%Apply a forward fast discrete curvelet transformation to x.
%The input image is of the size MxN
%The resulting pyramidial structure of the curvelet coefficients is sorted by size
%and truncated to the size MN. This way, the transformed image X and the original image x
%have same size. The original pyramidial structure will be reconstructed while the iFDCT is performed, filling
%neglected coefficients with 0.

[M, N] 	= size(x);
C 	= fdct_wrapping(x, is_real, finest, nbscales, nbangles_coarse);

stacked = [];
for s=1:length(C) 
  for w=1:length(C{s})
    stacked = [stacked; C{s}{w}(:)];
  end