nf2ff: verify read-only data with requested values

pull/1/head
Thorsten Liebig 2012-02-17 12:34:17 +01:00
parent f64843b14f
commit 3439ca6834
1 changed files with 21 additions and 0 deletions

View File

@ -69,6 +69,11 @@ openEMS_Path = [dir filesep '..' filesep];
if ((exist(nf2ff.hdf5,'file') && (mode==0)) || (mode==2))
disp('CalcNF2FF: Reading nf2ff data only...')
nf2ff = ReadNF2FF(nf2ff);
% verify read data
if ( (vectorEqual(nf2ff.freq,freq)==0) || (vectorEqual(nf2ff.theta,theta)==0) || (vectorEqual(nf2ff.phi,phi)==0) )
error('openEMS:CalcNF2FF','data mismatch between read and requested data --> recalculate nf2ff --> Set Mode to 1 ');
end
return;
end
@ -91,3 +96,19 @@ catch
end
nf2ff = ReadNF2FF(nf2ff);
function equal = vectorEqual(v1, v2, acc)
if (nargin<3)
acc = 1e-6;
end
equal = 0;
if numel(v1)~=numel(v2)
return;
end
if sum(abs(v1(:)-v2(:)) > acc)>0
return;
end
equal = 1;
return