diff --git a/encode.m b/encode.m
index b63b81f9145c11c5cd5e5cf64faba0c90aaabc65..0298ffcf02a2f9b31e40648425d9193d7d20c469 100644
--- a/encode.m
+++ b/encode.m
@@ -31,7 +31,7 @@ perm = 1:numel(p.Parameters);
 indconf = find(strcmp('ConfigFile',p.Parameters));
 perm(1) = indconf; perm(indconf) = 1;
 
-results = orderfields(p.Results,perm);
+results = orderfields(p.Results,perm); results = rmfield(results,'ReconFile');
 unmatched = p.Unmatched;
 
 parameters = fieldnames (results);
@@ -40,11 +40,11 @@ values     = struct2cell(results);
 extraParameters = fieldnames (unmatched);
 extraValues     = struct2cell(unmatched);
 
-ReconFile     = p.Results.ReconFile;
+
 BitstreamFile = p.Results.BitstreamFile;
 LogFile       = p.Results.LogFile;
 
-for file={ReconFile,BitstreamFile,LogFile}
+for file={BitstreamFile,LogFile}
     [folder,~,~] = fileparts(file{:});
     if ~(7==exist(folder,'dir'))
         mkdir(folder);
diff --git a/encodedecode.m b/encodedecode.m
new file mode 100644
index 0000000000000000000000000000000000000000..bdd15921503261cf76915bfbb41db7ccb0dc83a0
--- /dev/null
+++ b/encodedecode.m
@@ -0,0 +1,71 @@
+function p = encodedecode(varargin)
+%ENCODE Summary of this function goes here
+%   Detailed explanation goes here
+
+[HEVCDir,~,~] = fileparts(mfilename('fullpath'));
+TAppEncoder = fullfile(HEVCDir,'bin','TAppEncoder.exe');
+defaultCfg  = fullfile(HEVCDir,'cfg','intra.cfg');
+
+p = inputParser; p.KeepUnmatched = true; p.StructExpand = true;
+
+p.addParameter('ConfigFile'         ,defaultCfg,@ischar);
+p.addParameter('InputFile'          ,'ref.yuv' ,@ischar);
+p.addParameter('BitstreamFile'      ,'bit.hevc',@ischar);
+p.addParameter('ReconFile'          ,'rec.yuv' ,@ischar);
+p.addParameter('LogFile'            ,'log.rtf' ,@ischar);
+p.addParameter('SourceWidth'        ,'512'     ,@ischar);
+p.addParameter('SourceHeight'       ,'512'     ,@ischar);
+p.addParameter('InputBitDepth'      ,'8'       ,@ischar);
+p.addParameter('InternalBitDepth'   ,'8'       ,@ischar);
+p.addParameter('InputChromaFormat'  ,'420'     ,@ischar);
+p.addParameter('FrameRate'          ,'60'      ,@ischar);
+p.addParameter('FrameSkip'          ,'0'       ,@ischar);
+p.addParameter('FramesToBeEncoded'  ,'1'       ,@ischar);
+p.addParameter('QP'                 ,'30'      ,@ischar);
+p.addParameter('WarnUnknowParameter','1'       ,@ischar);
+% Add additional default parameters here
+
+p.parse(varargin{:});
+
+perm = 1:numel(p.Parameters);
+indconf = find(strcmp('ConfigFile',p.Parameters));
+perm(1) = indconf; perm(indconf) = 1;
+
+results = orderfields(p.Results,perm);
+unmatched = p.Unmatched;
+
+parameters = fieldnames (results);
+values     = struct2cell(results);
+
+extraParameters = fieldnames (unmatched);
+extraValues     = struct2cell(unmatched);
+
+ReconFile     = p.Results.ReconFile;
+BitstreamFile = p.Results.BitstreamFile;
+LogFile       = p.Results.LogFile;
+
+for file={ReconFile,BitstreamFile,LogFile}
+    [folder,~,~] = fileparts(file{:});
+    if ~(7==exist(folder,'dir'))
+        mkdir(folder);
+    end
+end
+
+argList = paramToArg([parameters;extraParameters],[values;extraValues]);
+command = [TAppEncoder,' ',argList];
+disp(command)
+status = system(command);
+if status, error('HEVC Error'); end
+
+end
+
+function argList = paramToArg(parameters,values)
+indLog  = strcmp(parameters,'LogFile'); ind = indLog;
+
+argLog  = strjoin(['>' ,values(indLog) ]);
+argList = cellfun(@(param,val) ['--',param,'=',val],...
+    parameters(~ind),values(~ind),'UniformOutput',false);
+
+argList = [argList;argLog];
+argList = strjoin(argList(:));
+end
\ No newline at end of file