118 |
error(sprintf('Argument %i > 9999999999',arg)) |
error(sprintf('Argument %i > 9999999999',arg)) |
119 |
end |
end |
120 |
itrs=arg; |
itrs=arg; |
121 |
|
elseif length(arg) == 1 & arg == -1 |
122 |
|
itrs=arg; |
123 |
else |
else |
124 |
error(sprintf('Argument %i must be a positive integer',arg)) |
error(sprintf('Argument %i must be a positive integer',arg)) |
125 |
end |
end |
148 |
end |
end |
149 |
|
|
150 |
% Match name of all meta-files |
% Match name of all meta-files |
151 |
allfiles=dir( sprintf('%s*.meta',fname) ); |
%fprintf(' search for file "%s".*meta\n',fname); |
152 |
|
allfiles=dir( sprintf('%s.*meta',fname) ); |
153 |
|
|
154 |
if size(allfiles,1)==0 |
if size(allfiles,1)==0 |
155 |
disp(sprintf('No files match the search: %s*.meta',fname)); |
disp(sprintf('No files match the search: %s.*meta',fname)); |
156 |
%allow partial reads% error('No files found.') |
%allow partial reads% error('No files found.') |
157 |
end |
end |
158 |
|
|
159 |
% Loop through allfiles |
% Loop through allfiles |
160 |
for j=1:size(allfiles,1); |
for j=1:size(allfiles,1); |
161 |
|
%fprintf(' file # %3i : %s\n',j,allfiles(j).name); |
162 |
|
|
163 |
% Read meta- and data-file |
% Read meta- and data-file |
164 |
[A,N,M,mG] = localrdmds([Dir allfiles(j).name],ieee,recnum); |
[A,N,M,mG] = localrdmds([Dir allfiles(j).name],ieee,recnum); |
172 |
if isempty(ii), jj1=0; jj2=0; |
if isempty(ii), jj1=0; jj2=0; |
173 |
else jj1=ii; jj2=ii+min(findstr(M(1+ii:end),'];')); end |
else jj1=ii; jj2=ii+min(findstr(M(1+ii:end),'];')); end |
174 |
if iter==1 & j==1, |
if iter==1 & j==1, |
175 |
MM=M; ind1=0; ind2=0; is1=ii1; js1=jj1; M3=''; |
MM=M; ind1=0; ind2=0; is1=ii1; js1=jj1; M3=''; |
176 |
if ii1*jj1 > 0, |
if ii1*jj1 > 0, |
177 |
%ind1=min(ii1,jj1); ind2=max(ii2,jj2); |
%ind1=min(ii1,jj1); ind2=max(ii2,jj2); |
178 |
%if ii1 < jj1, ii3=ii2+1; jj3=jj1-1; |
%if ii1 < jj1, ii3=ii2+1; jj3=jj1-1; |
179 |
%else ii3=jj2+1; jj3=ii1-1; end |
%else ii3=jj2+1; jj3=ii1-1; end |
180 |
order=sort([ii1 ii2 jj1 jj2]); |
order=sort([ii1 ii2 jj1 jj2]); |
181 |
ind1=order(1); ii3=order(2)+1; jj3=order(3)-1; ind2=order(4); |
ind1=order(1); ii3=order(2)+1; jj3=order(3)-1; ind2=order(4); |
182 |
M2=M(ii1:ii2); M4=M(jj1:jj2); M3=M(ii3:jj3); |
M2=M(ii1:ii2); M4=M(jj1:jj2); M3=M(ii3:jj3); |
183 |
elseif ii1 > 0, |
elseif ii1 > 0, |
184 |
ind1=ii1; ind2=ii2; |
ind1=ii1; ind2=ii2; |
185 |
M2=M(ii1:ii2); M4=''; |
M2=M(ii1:ii2); M4=''; |
186 |
elseif jj1 > 0, |
elseif jj1 > 0, |
187 |
ind1=jj1; ind2=jj2; |
ind1=jj1; ind2=jj2; |
188 |
M4=M(jj1:jj2); M2=''; |
M4=M(jj1:jj2); M2=''; |
189 |
end |
end |
196 |
%fprintf(' M4=%s<\n',M4); |
%fprintf(' M4=%s<\n',M4); |
197 |
%fprintf(' M5=%s<\n',M5); |
%fprintf(' M5=%s<\n',M5); |
198 |
else |
else |
199 |
if ii1*jj1 > 0, |
if ii1*jj1 > 0, |
200 |
order=sort([ii1 ii2 jj1 jj2]); |
order=sort([ii1 ii2 jj1 jj2]); |
201 |
ind=order(1); ii3=order(2)+1; jj3=order(3)-1; ind2=order(4); |
ind=order(1); ii3=order(2)+1; jj3=order(3)-1; ind2=order(4); |
202 |
else ind=max(ii1,jj1); ind2=ii2+jj2; end |
else ind=max(ii1,jj1); ind2=ii2+jj2; end |
224 |
end |
end |
225 |
end |
end |
226 |
% save modifications: |
% save modifications: |
227 |
if ind1>0 & j==size(allfiles,1) & iter==size(itrs,2), |
if ind1>0 & j==size(allfiles,1) & iter==size(itrs,2), |
228 |
if ii1 < jj1, MM=[MM(1:ind1-1),M2,M3,M4,M5]; |
if ii1 < jj1, MM=[MM(1:ind1-1),M2,M3,M4,M5]; |
229 |
else MM=[MM(1:ind1-1),M4,M3,M2,M5]; end |
else MM=[MM(1:ind1-1),M4,M3,M2,M5]; end |
230 |
end |
end |
231 |
end |
end |
232 |
|
|