Doug's MATLAB Video Tutorials

Results for: Level: Advanced

Debugging: creating a line with empty data

Posted by Doug Hull,

Debugging: creating a line with empty data In this video we are sorting through some data making a different line for all the data points that match certain criteria. At some point in the algorithm none of the data meets the criteria. This is the equivalent of this: >> a = 1 a = ... read more >>

uicontextmenu and ButtonDownFcn in MATLAB 5

Posted by Doug Hull,

uicontextmenu and ButtonDownFcn in MATLAB When you use ButtonDownFcn in MATLAB, your callback is given an automatic input called hObject. This hObject is the handle of the object that you interacted with to invoke the callback, which makes it easy to define behavior based on the selected object. This is a little trickier when working... read more >>

Using one callback function for multiple UI objects in GUIDE 1

Posted by Doug Hull,

Using one callback function for multiple UI objects in GUIDE By default, GUIDE creates one callback function for every object in a UI. Sometimes, you want to have one callback function serve multiple objects. This video shows one way to do this, by manually editing the callback property for multiple objects to point to the same callback function. This trick... read more >>

Custom interactive graphics in MATLAB 3

Posted by Doug Hull,

Custom interactive graphics in MATLAB Knowing how to use callbacks in MATLAB allows you to customize your graphics and make them more interactive. This short video shows you how to highlight a line in MATLAB by clicking on it. ... read more >>

Knowing when to optimize code in MATLAB

Posted by Doug Hull,

Knowing when to optimize code in MATLAB I work with a lot of recent computer science graduates who are learning MATLAB. Something I see from them is they often want to choose some complicated but fast algorithm to do a task I give to them in MATLAB class. Only after they spend a long time... read more >>

Making a line visible over an image in MATLAB 5

Posted by Doug Hull,

Making a line visible over an image in MATLAB It can be difficult to see a line that is drawn over an image. The line is often lost in the background colors. That is why cursors are colored as they are, so that they are visible on any background. I demonstrate some code that makes a... read more >>

Generalizing the access to an array of structures in MATLAB 2

Posted by Doug Hull,

Generalizing the access to an array of structures in MATLAB Recently a MATLAB user asked me how to make it possible to work with an array of structures in such a way that she could filter the array of structures and then combine the remaining fields. Once combined she would run arbitrary processing functions on this combined data. This generalized... read more >>

Using ‘dbstop if error’ and conditional breakpoints to debug MATLAB 1

Posted by Doug Hull,

Using ‘dbstop if error’ and conditional breakpoints to debug MATLAB Sometimes MATLAB throws an error, but because the error is inside of a function you can not see what caused this error. By telling the debugger to stop execution under certain conditions or right before an error is thrown you will be better able to understand the conditions that... read more >>

Example: Speed up MATLAB code by profiling

Posted by Doug Hull,

Example: Speed up MATLAB code by profiling Sometimes the performance of MATLAB code can depend greatly on the algorithm or the specific functions called. In this example, we show how we use the profiler (and good knowledge of logical indexing in MATLAB) to speed up some MATLAB code by nearly a factor of ten. ... read more >>

Simple test scripts in MATLAB

Posted by Doug Hull,

Simple test scripts in MATLAB Testing your code is important to make sure that it works correctly and continues to work correctly as you modify it. The more long lived the code, the more important testing becomes. I have found that I often want something very small and lightweight for testing fairly small... read more >>

These postings are the author's and don't necessarily represent the opinions of MathWorks.