Stuart’s MATLAB Videos

Watch and Learn

Formatting code for readability 1

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... read more >>

Writing out your workspace variables as a script with Simulink.saveVars 4

Posted by Doug Hull,

I almost never use Simulink, so I never saw this function before (requires Simulink). Try this at the command line: a = 1; b = 2.5; c = 'A string'; d = {a, b, c}; Simulink.saveVars('MyVars'); It produces a file like this: % ------------------------------------------------------------------- % MATLAB file generated by Simulink.saveVars on 27-Sep-2010 13:52:16 % MATLAB version:... read more >>