35 lines
800 B
Matlab
35 lines
800 B
Matlab
function[objs] = setLabel(objs, pattern)
|
|
|
|
%% define possible coding styles of markers
|
|
if (~ischar(pattern))
|
|
error('Pattern must be character array')
|
|
end
|
|
|
|
%% check for existing patterns
|
|
for o = 1:length(objs)
|
|
|
|
obj = objs(o);
|
|
|
|
for l = 1:length(obj.label_patterns)
|
|
|
|
if strcmp(obj.label_patterns{l}, pattern)
|
|
display('Label already specified.');
|
|
return;
|
|
end
|
|
|
|
end
|
|
|
|
if isempty(obj.label_patterns)
|
|
obj.label_patterns{1} = pattern;
|
|
else
|
|
if iscell(obj.label_patterns);
|
|
for i = 1:length(obj.label_patterns)
|
|
obj.label_patterns{i} = obj.label_patterns{i};
|
|
end
|
|
obj.label_patterns{i+1} = pattern;
|
|
end
|
|
end
|
|
|
|
objs(o) = obj;
|
|
|
|
end |