How do I disable the "snap to grid" feature in Simulink 7.6 (R2010b)?

17 views (last 30 days)
When trying to align annotation textbox or Simulink blocks in a Simulink model, I have noticed that if I drag the textbox to the right by 1 or 2 pixel and release the mouse click, the textbox "snaps" back to its original location. The textbox only moves to a different location if the displacement is larger than 5 pixels. Is there a way to make minute alignment changes?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 4 Jan 2013
Simulink by design has a snap to 5x5 grid behavior and cannot be disabled. Use the command line approach to make minute alignment changes. For example, open the 'vdp.mdl' demo model by typing
vdp
in the MATLAB Command Window. Enter the text 'EXAMPLE' anywhere in the model. Obtain the handle to the text by entering
h = find_system(gcs, 'FindAll', 'on', 'type', 'annotation', 'text','EXAMPLE')
We can obtain its current position by
coord = get_param(h,'Position')
We can then move the text by 1 pixel to the right via the 'set_param' command, e.g.,
set_param(h,'Position',[coord(1)+1 coord(2)])

More Answers (0)

Categories

Find more on Interactive Model Editing in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2010b

Community Treasure Hunt

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

Start Hunting!