Reputation: 97591
Say I have a simple plot:
f = figure;
line = plot([1, 2, 3], [1, 4, 9]);
I can make a copy of the line with copyobj
, and change some properties:
line2 = copyobj(line, line.Parent);
set(line2, 'SomeProp', ...);
Is there any way to modify the properties after the copy, but before setting the .Parent
?
Upvotes: 1
Views: 32
Reputation: 97591
It seems that passing a string into copyobj
trick it into not setting the parent:
line2 = copyobj(line, 'tricked you');
assert(isempty(line2.Parent));
set(line2, 'SomeProp', ...);
line2.Parent = line.Parent;
I can't find any documentation for why this isn't just an error though
Upvotes: 1