function [D, X] = trainKSVD(Y, Tdata, dictsize, iter);

params.data = Y;
params.Tdata = Tdata; % sparsity of each example, e.g. 30
params.dictsize = dictsize;
params.iternum = 5;
params.memusage = 'high';
[initD, X] = ksvd(params, '');


params.data = Y;
params.Tdata = Tdata; % sparsity
params.initdict = initD;
params.iternum = iter;
params.memusage = 'high';
[D, X] = ksvd(params, '');








