应该是xlabel 里的ax不能是向量。代码在下面。
只能用循环批量设置了,eval 或者sprintf。
- function hh = xlabel(varargin)
- %XLABEL X-axis label.
- % XLABEL('text') adds text beside the X-axis on the current axis.
- %
- % XLABEL('text','Property1',PropertyValue1,'Property2',PropertyValue2,...)
- % sets the values of the specified properties of the xlabel.
- %
- % XLABEL(AX,...) adds the xlabel to the specified axes.
- %
- % H = XLABEL(...) returns the handle to the text object used as the label.
- %
- % See also YLABEL, ZLABEL, TITLE, TEXT.
- % Copyright 1984-2014 The MathWorks, Inc.
- narginchk(1,inf);
- % if the input has an xlabel property which is a text object, use it to set
- % the xlabel on.
- [ax,args,nargs] = labelcheck('XLabel',varargin);
- if isempty(ax)
- ax = gca;
- args = varargin;
- end
- if nargs > 1 && (rem(nargs-1,2) ~= 0)
- error(message('MATLAB:xlabel:InvalidNumberOfInputs'))
- end
- string = args{1};
- if isempty(string), string=''; end;
- pvpairs = args(2:end);
- if isappdata(ax,'MWBYPASS_xlabel')
- h = mwbypass(ax,'MWBYPASS_xlabel',string,pvpairs{:});
- %---Standard behavior
- else
- h = get(ax,'XLabel');
- set(h,'FontSizeMode','auto',...
- 'FontUnitsMode','auto',...
- 'FontWeight',get(ax,'FontWeight'),...
- 'FontAngle',get(ax,'FontAngle'),...
- 'FontName',get(ax,'FontName'));
- set(h, 'String', string, pvpairs{:});
-
- end
- if nargout > 0
- hh = h;
- end
复制代码 |