dot notation for array

12 次查看(过去 30 天)
Josh
Josh 2014-12-13
编辑: Guillaume 2014-12-13
MATLAB R2014:
I am trying to replace the following set command by a dot notation:
hax=gca;
hgraf=hax.Children;
set (hgraf, 'Color' , currentColor);
% what I was trying is:
% hgraf.Color=currentColor;
% I also tried:
% hgraf(:).Color=currentColor;
% both with currentColor defined as a scalar (which is the case used in the set command, or as an array (of correct length).
% I keep getting error:
%Insufficient number of outputs from function on right hand side of equal sign to satisfy % overloaded assignment.

采纳的回答

Guillaume
Guillaume 2014-12-13
编辑:Guillaume 2014-12-13
Try:
[hgraf.Color] = deal(CurrentColor);
Or you could just be explicit and use:
for hchild = hgraf'
hchild.Color = CurrentColor;
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by