Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F111662949
fixoldorg.m
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, May 4, 06:24
Size
918 B
Mime Type
text/x-Algol68
Expires
Tue, May 6, 06:24 (2 d)
Engine
blob
Format
Raw Data
Handle
25950688
Attached To
R6832 iCAPs public
fixoldorg.m
View Options
function input = fixoldorg(input, revert)
% FIXOLDORG use "old/new" instead of "org/new"
if nargin<2
revert = false;
end
if ~(isstruct(input) && numel(input)==1)
% this does not look like a montage or a sensor description
return
end
if ~revert
from = {'labelorg', 'chantypeorg', 'chanunitorg', 'chanposorg', 'chanoriorg'};
to = {'labelold', 'chantypeold', 'chanunitold', 'chanposold', 'chanoriold'};
else
to = {'labelorg', 'chantypeorg', 'chanunitorg', 'chanposorg', 'chanoriorg'};
from = {'labelold', 'chantypeold', 'chanunitold', 'chanposold', 'chanoriold'};
end
% replace the fields
for i=1:numel(from)
if isfield(input, from{i})
input.(to{i}) = input.(from{i});
input = rmfield(input, from{i});
end
end
% use recursion to update the subfields
fn = fieldnames(input);
for i=1:numel(fn)
if isstruct(input.(fn{i}))
input.(fn{i}) = fixoldorg(input.(fn{i}), revert);
end
end
Event Timeline
Log In to Comment