When direc is empty then ccmp is not defined (exactly as the error message states).
This error is easy to demonstrate (showing that the problem is in your code, not the function signature):
The solution depends on what you want to do when no files are found: you could throw an error, search for some other files, or define a default value before the loop, e.g.:
ccmp = struct();
for j = ...
Note that the code overwrite some of ccmp's fields on each loop iteration.