MATLAB: Saving a file name in a matrix and the result on each iteration (for-loop)

errorfor loopMATLABsave

I have a folder with 140 (*. Txt) files and I need save in a matrix these files names and the result of the process in a for-loop. I have tried this:
% code
class= fullfile('*.txt');
D = dir(class);
data=zeros(length(D),2);
for kk=1:length(D);
blockname = D(kk).name;
%process > result(kk);
data(kk,1)=result(kk);
data(kk,2)= blockname;
end
but the next error message is displayed
data(kk,2)= blockname; ??? Subscripted assignment dimension mismatch.
Because
>> blockname
blockname =
block_100.txt
I do not have idea how solve it. Thanks in advance for your help.

Best Answer

Try using a cell array instead of a numeric matrix.