image processing - I don't get the use of axis(1:2) in Matlab? -
i in front of following (modified) matlab code :
figure(3); subplot(2,3,2); axises=axis; center = [mean(axises(1:2)),mean(axises(3:4))]' my problem :
- why did use
axises, not keep usingaxis? - what
axises(1:2)?
i have checked axis documentation, there no mention 1:2 or 3:4 ?
please, easy question expert in matlab.
the function axis different things whether pass argument or not. without parameters, returns current axis bounds (see documentation here), whereas parameters, tries set current axis specified range (documentation).
axises = axis stores current axis bounds in axises, can extract elements from. axises(1:2) gets first 2 elements of axis (which [xmin xmax]), , axises(3:4) gets 3rd , 4th elements (which [ymin ymax]). result of mean(axises(1:2)) average of xmin , xmax, you'd expect center(1) be. same y component.
you can't use axis(1:2) instead of axises(1:2), because matlab interpret attempting call function axis argument 1:2 rather extracting first 2 elements of current axis
example:
>> axis(1:2) error using axis>locsetlimits (line 227)
vector must have 4, 6, or 8 elements.error in axis (line 93)
locsetlimits(ax(j),cur_arg);
>> axises = axis; >> axises(1:2) ans = 0 10
Comments
Post a Comment