Contents
close all
clear
clc
A file to re publish all html doc file
Super long, carefull with it
dir_root=fileparts(which('CODES.install')); dirs={[dir_root '/+common/'];... [dir_root '/+demo/'];... [dir_root '/+doc/'];... [dir_root '/+fit/'];... [dir_root '/+sampling/'];... [dir_root '/+sensitivity/']}; for j=1:length(dirs) % Gather doc files doc_files=dir(dirs{j}); % Exclude some stuff tag=false(length(doc_files),1); for i=1:length(doc_files) switch doc_files(i).name case {'.','..','html'} tag(i)=true; otherwise tag(i)=false; end if doc_files(i).name(end)=='~' tag(i)=true; end if strcmp(doc_files(i).name,'republish_doc.m') tag(i)=true; end % if strcmp(doc_files(i).name,'replace_everywhere.m') % tag(i)=true; % end if length(doc_files(i).name)>3 if strcmpi(doc_files(i).name(end-3:end),'.asv') tag(i)=true; end end if doc_files(i).isdir tag(i)=true; end end doc_files(tag)=[]; for i=1:length(doc_files) file_name=[dirs{j} doc_files(i).name]; fin=fopen(file_name,'r'); fout=fopen([file_name(1:end-1) 'newm'],'w'); while ~feof(fin) line=fgetl(fin); % BEGIN text to replace % line=strrep(line,'2013-2015','2013-2015'); % line=strrep(line,'a=fileparts(which(''CODES.install''));file=strcat(a,''\','a=fileparts(which(''CODES.install''));file=strcat(a,''/'); line=strrep(line,'.sampling.','.sampling.'); % END text to replace fprintf(fout,'%s\n',line); end fclose(fin); fclose(fout); copyfile([file_name(1:end-1) 'newm'],file_name,'f'); delete([file_name(1:end-1) 'newm']); % if strcmpi(file_name(end-1:end),'.m') % delete([file_name(1:end-1) 'newm']) % end end end