Doug's MATLAB Video Tutorials
July 20th, 2011
Managing code in MATLAB: Functions of variable numbers of inputs and outputs
This is the first series of MATLAB video tutorials that are an attempt to systematically make videos for a “technology trees” for using MATLAB. This first tree covers the various kinds of MATLAB files you might write. The tree shows you the order you should watch them because some rely on skills you need to learn from earlier videos, but some do not.
This video will allow you to do input parsing so that you have the ability to overload functions, meaning allow them to react differently to different inputs.
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
17:39 UTC |
Posted in Format: Video, Level: Basic |
Permalink |
1 Comment »
July 8th, 2011
Managing code in MATLAB: Functions of multiple inputs and outputs
This is the first series of MATLAB video tutorials that are an attempt to systematically make videos for a “technology trees” for using MATLAB. This first tree covers the various kinds of MATLAB files you might write. The tree shows you the order you should watch them because some rely on skills you need to learn from earlier videos, but some do not.
This video will modify the function to accept more inputs and give more outputs.
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
14:04 UTC |
Posted in Format: Video, Level: Basic |
Permalink |
4 Comments »
June 27th, 2011
Managing code in MATLAB: Functions of one input and one output
This is the first series of MATLAB video tutorials that are an attempt to systematically make videos for a “technology trees” for using MATLAB. This first tree covers the various kinds of MATLAB files you might write. The tree shows you the order you should watch them because some rely on skills you need to learn from earlier videos, but some do not.
This video will make a function of one input and one output that we will modify through much of the rest of the tree.
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
17:28 UTC |
Posted in Format: Video, Level: Basic |
Permalink |
No Comments »
June 20th, 2011
Managing code in MATLAB: Functions
This is the first series of MATLAB video tutorials that are an attempt to systematically make videos for a “technology trees” for using MATLAB. This first tree covers the various kinds of MATLAB files you might write. The tree shows you the order you should watch them because some rely on skills you need to learn from earlier videos, but some do not.
This video will make a simple function, then the next video will make a different function of one input and one output that we will modify through much of the rest of the tree.
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
13:33 UTC |
Posted in Format: Video, Level: Basic |
Permalink |
1 Comment »
June 13th, 2011
Managing code in MATLAB: Scripts
This is the first series of MATLAB video tutorials that are an attempt to systematically make videos for a “technology trees” for using MATLAB. This first tree covers the various kinds of MATLAB files you might write. The tree shows you the order you should watch them because some rely on skills you need to learn from earlier videos, but some do not.
You can see that understanding what a script is in MATLAB is the fundamental skill needed to understand functions, subfunctions, etc…
This video will show how and why you write script files in MATLAB.
Stuart did a video that covers this material in a similar but different way.
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
19:46 UTC |
Posted in Format: Video, Level: Basic |
Permalink |
4 Comments »
June 3rd, 2011
Inserting data into a vector in MATLAB
If you want to insert a data point into an existing series, you may need to insert a corresponding data point in another vector in the same place. You could do that with logical indexing and concatenation of vectors as shown in this video.
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
15:13 UTC |
Posted in Format: Video, Level: Basic |
Permalink |
2 Comments »
May 27th, 2011
Top five productivity practices in MATLAB
I teach the “MATLAB 101″ course for all of our new technical support engineers at MathWorks. When I come to their computers, I become aware of little tweaks I have made to my working style and MATLAB environment that save me steps, or a few seconds HUNDREDS of times a day. Here are five tips that you can implement right now to make things better for you.
- Use shortcuts on desktop
You can add custom shortcuts to the MATLAB desktop to get single-click access to any MATLAB code you run often. I see so many people that leave their MATLAB desktop with just the default shortcuts:
I made the following shortcuts by just dragging code from the command window or editor directly to the shortcut bar. You can learn more about making shortcuts here. Here are the shortcuts I find myself using all of the time:
Gets MATLAB back into a fresh state
clear
clc
close all
Opens the current directory in Windows
winopen(pwd)
Changes directory to a common destination
cd('C:\Users\dhull\Desktop')
Make all future figure windows start docked
set(0,'DefaultFigureWindowStyle','docked');
Make all future figure windows start normally
set(0,'DefaultFigureWindowStyle','undocked');
- Dock windows in the desktop
I see so many people spend a few seconds hunting for the editor, figure windows, etc *every* time they switch contexts. This is so easily avoided, just put MATLAB full screen, dock the desktop components if they aren’t already docked (using the little arrow in the upper right corner of each component) and rearrange the desktop components until you can see everything at once.
- Make throw-away scripts
MATLAB is great because you can use it interactively. However, I see people too often do everything at the command line and forget how they got to whatever state they end up in. They then need to dig around the command history looking for the specific commands they used that worked.
If you work in a script, and just keep modifying it as you go, you know exactly how you got to the state you finish in. I also recommend starting the script with
clear
clc
close all
so that you always start in a known state. One small gotcha – if you are using the debugger, don’t include the clear command at the beginning of your script. It will clear your debugger breakpoints in addition to clearing your workspace variables.
- Use F5 to save and run
The script I mentioned above is a lot easier to iterate on if you just hit F5 to save and run.
- Use run configurations
You can click the down arrow on the right side of this button
to see a script that you can run when you hit F5. This is an advanced form of the above tip. It allows you to specify a script to run when you hit F5. This is often used to set up the environment for a function that you are working on.
These five tips will save you a few seconds each, hundreds of times a day. They will make MATLAB programming much faster and keep you in the flow!
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
15:30 UTC |
Posted in Level: Basic |
Permalink |
5 Comments »
May 16th, 2011
Using logical indexing to plot points meeting a specific criteria only.
If you have a vector of coordinate for a set of points, you might want to differentiate those points. To do that a concept called logical indexing will help you pull out a subset of those points easily.
Here is a quick example (See the second video for more details)
>> L = logical([0 1 0 1])
L =
0 1 0 1
>> a = [1 2 3 4]
a =
1 2 3 4
>> a(L)
ans =
2 4
The above video made practical use of logical indexing. The video below shows logical indexing in a more academic treatment.
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
19:08 UTC |
Posted in Level: Basic, Topic: Practical example |
Permalink |
No Comments »
May 9th, 2011
Using image to view data instead of surf and view(2).
This video outlines a common error made with MATLAB, and how to avoid it.
Often people will use the programming pattern of:
surf(Z);
view(2)
This really does something very similar to:
imagesc(Z)
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
14:18 UTC |
Posted in Level: Basic |
Permalink |
2 Comments »
April 29th, 2011
Sudoku solver in MATLAB by webcam
From our Japan office via Steve’s blog:
This just tickles my fancy, and I think everyone should watch it.
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
15:40 UTC |
Posted in Topic: Practical example |
Permalink |
2 Comments »
|
Recent Comments