Stuart’s MATLAB Videos

Watch and Learn

Results for: 2010

Subplot vs axes 4

Posted by Doug Hull,

Subplot is a convenience function that wraps around the lower level axes function. It simplifies the layout process. As a higher level function, it does some bookkeeping for you. This debugging session shows that the helpful things it does can be confusing if you are not expecting… read more >>

MATLAB contest: sneak peak

Posted by Doug Hull,

There are two big events coming up that I want to share with you: MathWorks Virtual Career Fair on Thursday November 11th. This is an opportunity to talk directly with Engineers and Hiring Managers. The second is the MATLAB programming contest. This video will tell you a little bit more about what floats… read more >>

Making a matrix in a loop in MATLAB 39

Posted by Doug Hull,

A for loop is used to construct a simple matrix with an underlying pattern. Pre-allocation is addressed in the second half of the video. if (typeof(playerLoaded) === ‘undefined’) {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs) !== ‘undefined’) {videojs(“mathworks-brightcove-player”).on(‘loadedmetadata’, function() {playerLoaded = true;});} else {setTimeout(isVideojsDefined, 10);}})(); … read more >>

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 >>

Deleting in a loop 5

Posted by Doug Hull,

Ever try to delete some values in a vector by looping through from beginning to end? I have, and failed because the indexing got confused as the vector changed. Here is one solution to that class of problems. if (typeof(playerLoaded) === ‘undefined’) {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs)… read more >>