function build_comparison_cfile(export_folders_output, file_pointers, format_options)
% Generates a .cfile with links to each of the generated models.
%
% :param export_folders_output:   array - Name of folders where the morphed
%                                 models are placed.
% :param file_pointers: struct - Struct with file names.
%
% :return None: Nothing is returned. If successful, a file is created.
%
% created by : ABR august@lightness.eu
% date : 2024-06-11

fileID = fopen([file_pointers.compare_output_dir file_pointers.cfile_out_name],'w');
fprintf(fileID,'import keyword "%s"\n',[export_folders_output{1} 'Surface_Model_w_Joints_v0_0_1.k'])
fprintf(fileID,'genselect target node\n');
fprintf(fileID,'genselect allvis\n');
fprintf(fileID,'rotate_model 0 0 0 z -90\n');
fprintf(fileID,'rotate_model accept 0 26013656 3501186\n');
fprintf(fileID,'translate_model %4d 0 %4d\n',-600, 0);
fprintf(fileID,'translate_model accept 0 26013656 35011866\n');
fprintf(fileID,'selectpart all off\n');
fprintf(fileID,'import keyword offset\n');

for cLoop = 1:length(export_folders_output)
  fprintf(fileID,'import keyword "%s"\n',[export_folders_output{cLoop} file_pointers.morphed_dir_name filesep 'Surface_Model_w_Joints_v0_0_1.k'])
  fprintf(fileID,'genselect target node\n');
  fprintf(fileID,'genselect allvis\n');
  fprintf(fileID,'rotate_model 0 0 0 z -90\n');
  fprintf(fileID,'rotate_model accept 0 26013656 3501186\n');
  fprintf(fileID,'translate_model %4d 0 %4d\n',format_options.cfile_translate_X(cLoop), format_options.cfile_translate_Z(cLoop));
  fprintf(fileID,'translate_model accept 0 26013656 35011866\n');
  fprintf(fileID,'selectpart all off\n');
  fprintf(fileID,'import keyword offset\n');

end

fprintf(fileID,'selectpart all off\n');
fprintf(fileID,'import keyword offset\n');
fprintf(fileID,'selectpart all on\n');
fprintf(fileID,'genselect none\n');
fprintf(fileID,'left on\n');
fprintf(fileID,'ac on\n');
fprintf(fileID,'mesh off\n');
fprintf(fileID,'colormap load "%s\n"',[file_pointers.input_dir 'Surface_Model_Color_Map']);
fprintf(fileID,'outlinecolor 0.588235 0.588235 0.588235\n');
fclose(fileID);



