Stuart’s MATLAB Videos

Watch and Learn

Formatting code for readability 3

Posted by Doug Hull,

The use of whitespace can make your code more pleasant to read. This is not just a nicety, it actually makes it easier to see the structure of your code and makes it more clear where code breaks the established patterns to help find bugs (like copy and paste bugs). Though not presented in this video, Scott pointed out that comments and cell dividers are also excellent ways to format code.

3 CommentsOldest to Newest

the cyclist replied on : 1 of 3
I have used whitespace in this way for a long time, and I teach rookie developers to do the same. Another advantage to coding in this way is that when portions of code that are logically parallel are written in a visually parallel way, it helps avoid simple typos and other bugginess.
PRERNA GUPTA replied on : 2 of 3
I have programme coading . But i dont know how to install and run these coading in metlab
Stuart McGarrity replied on : 3 of 3
Hi Prerna, Have you used MATLAB before? Have you looked at Getting Started materials? e.g. https://www.mathworks.com/videos/getting-started-with-matlab-68985.html