File Exchange

image thumbnail

Align equal sign

version 1.5.0.0 (2.17 KB) by Alessandro Masullo
Automatically align equal sign in variables assignment

5 Downloads

Updated 02 Oct 2014

View Version History

View License

This function allows you to align equal signs in the matlab editor.
Select some text with variables assignments from the editor and run the function.

You may find easier to add this function as a shortcut to your matlab toolbar.

This function is not intended to work on your whole code, but only on snippets of variables assignments.

This code has been inspired by Replace in selection: http://www.mathworks.co.uk/matlabcentral/fileexchange/38264-find-and-replace-in-selection
If you find any bug, please report it here.

Cite As

Alessandro Masullo (2020). Align equal sign (https://www.mathworks.com/matlabcentral/fileexchange/47918-align-equal-sign), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Xingwang Yong

Xingwang Yong

Logan

Luna

Rasmus Bang

Works great for its intention. Thank you!

Alessandro Masullo

@Matthew
You're right, I forgot to mention that the code is made to work with small snippets of code!
You shall select only the group of variables you want to align and then run the function.
It won't work if you select your entire script.

Matthew

Good first effort. However, I wanted this function to be great and couldn't recommend it to other users right now.

Some thoughts:
1. Where is the test script?
2. Did you run the function on the source itself?
3. The approach does not separate assignment (lhs = rhs) from equalityTest (==) or strings ('=').
4. Are the options comparable to known non-MATLAB tools (e.g., Uncrustify)?

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: Align Matrix

Community Treasure Hunt

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

Start Hunting!