| set hold to on, freeze axis scaling (axis set to manual), and then create a larger rectangle. CreateFcn functional handle, cell array containing function handle and additional arguments, or string (not recommended) Callback function executed during object creation. This property defines a callback function that executes when MATLAB creates a rectangle object. You must define this property as a default value for rectangles or in a call to the rectangle function to create a new rectangle object. For example, the statement set(0,'DefaultRectangleCreateFcn',@rect_create) defines a default value for the rectangle CreateFcn property on the root level that sets the axes DataAspectRatio whenever you create a rectangle object. The callback function must be on your MATLAB path when you execute the above statement. function rect_create(src,evnt) % src - the object that is the source of the event % evnt - empty for this property axh = get(src,'Parent'); set(axh,'DataAspectRatio',[1,1,1])) end MATLAB executes this function after setting all rectangle properties. Setting this property on an existing rectangle object has no effect. The function must define at least two input arguments (handle of object created and an event structure, which is empty for this property). ThehandleoftheobjectwhoseCreateFcn is being executed is passed by MATLAB as the first argument to the callback function and is also accessible through the root CallbackObject property, which you can query using gcbo. |