The easy way:
X = num2cell(X,1);
Or, creating the sparse matrix directly:
[r,c] = size(X);
i = 1:numel(X);
j = repmat(1:c,r,1);
B = sparse(i',j(:),X(:));
The second method is not only ~30-40 times faster but avoids creating the intermediate blkdiag() double matrix, which can easily cause out of memory.
Honestly, I don't know if you have that kind of memory:
(30 * 1e6) rows * 1e6 cols * 8 bytes ~ 218.2 TB
Therefore, go for the second method.