Commit a30c1ed9 authored by Marco Berzborn's avatar Marco Berzborn

Fixed saving of coordinate class objects. Now using the saveobj method of...

Fixed saving of coordinate class objects. Now using the saveobj method of itaCoordinates when writing .ita files.
parent 29ce0083
......@@ -173,17 +173,6 @@ classdef itaAudio < itaSuper
result = ita_impedance_parallel(this,that);
end
%% Other stuff
% Now implemented as dependent property
% function result = trackLength(this)
% result = (this.nSamples -1)./ this.samplingRate * itaValue('1s');
% end
%
%
% function result = fftDegree(this)
% result = log2(this.nSamples);
% end
function result = isEvenSamples(this)
%isEvenSamples - return 1 if sample number is even
result = this.mEvenSamples;
......
......@@ -549,9 +549,9 @@ classdef itaCoordinates
end
function this = loadobj(sObj)
% Called when an object is loaded
if isfield(sObj,'classrevision'), sObj = rmfield(sObj,{'classrevision'}); end;
if isfield(sObj,'classname'), sObj = rmfield(sObj,{'classname'}); end;
if isfield(sObj,'userName'), sObj = rmfield(sObj,{'userName'}); end;
if isfield(sObj,'classrevision'), sObj = rmfield(sObj,{'classrevision'}); end
if isfield(sObj,'classname'), sObj = rmfield(sObj,{'classname'}); end
if isfield(sObj,'userName'), sObj = rmfield(sObj,{'userName'}); end
try
this = itaCoordinates(sObj); % Just call constructor, he will take care
catch errmsg
......
......@@ -132,9 +132,15 @@ classdef itaSuper < itaMeta
end
end
end
if isstruct(varargin{1}) % Struct input/convert
% Struct input/convert
if isstruct(varargin{1})
fieldName = fieldnames(varargin{1});
preDataFields = {'domain', 'dataType', 'dataTypeOutput','mDataFactor','dataFactor'}; %RSC: Fields that must be set bevor data may be set
%RSC: Fields that must be set before data may be set
preDataFields = {'domain', ...
'dataType', ...
'dataTypeOutput', ...
'mDataFactor', ...
'dataFactor'};
for idfn = 1:numel(preDataFields)
if find(strcmpi(fieldName,preDataFields{idfn})) > find(strcmpi(fieldName,'data'))
idx = find(strcmpi(fieldName,preDataFields{idfn}));
......@@ -142,9 +148,22 @@ classdef itaSuper < itaMeta
fieldName = fieldnames(varargin{1});
end
end
coordinateFields = {'channelCoordinates', ...
'channelOrientation', ...
'objectCoordinates', ...
'objectViewVector', ...
'objectUpVector'};
for ind = 1:numel(fieldName)
try
this.(fieldName{ind}) = varargin{1}.(fieldName{ind});
if any(strcmpi(fieldName{ind}, coordinateFields))
% use the constructor here as old .ita
% files may have objects of itaCoordinates
% stored instead of structs generated by
% the saveobj method
this.(fieldName{ind}) = itaCoordinates(varargin{1}.(fieldName{ind}));
else
this.(fieldName{ind}) = varargin{1}.(fieldName{ind});
end
catch errmsg
disp(errmsg);
end
......@@ -811,31 +830,6 @@ classdef itaSuper < itaMeta
ylabel('y');
end
% function pcolor(this,freq,varargin)
% %plot data by using coordinates
% % pcolor(Obj, freq(double), ['axishandle',handle, 'size', double, 'title', titleStr])
% pdi: does not work in this way !!!
% sArgs = struct('axishandle',[],'size',10,'title',this.comment,'noabs',false);
% sArgs = ita_parse_arguments(sArgs,varargin);
% if isempty(sArgs.axishandle)
% figure;
% else
% axes(sArgs.axishandle);
% end
% if sArgs.noabs
% pcolor(this.channelCoordinates.x,this.channelCoordinates.y, ...
% this.freq2value(freq));
% else
% pcolor(this.channelCoordinates.x,this.channelCoordinates.y, ...
% this.freq2value(freq)*0+sArgs.size,abs(this.freq2value(freq)),'filled','square');
% end
% axis image; colorbar
% title([sArgs.title ' (' this.channelUnits{1} ') - ' num2str(freq) ' Hz ' ]);
% xlabel('x');
% ylabel('y');
% end
end
methods(Hidden = true)
......@@ -967,7 +961,11 @@ classdef itaSuper < itaMeta
% Copy all properties that were defined to be saved
propertylist = itaSuper.propertiesSaved;
for idx = 1:numel(propertylist)
sObj.(propertylist{idx}) = this.(propertylist{idx});
if isa(this.(propertylist{idx}), 'itaCoordinates')
sObj.(propertylist{idx}) = saveobj(this.(propertylist{idx}));
else
sObj.(propertylist{idx}) = this.(propertylist{idx});
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment