Stuart’s MATLAB Videos

Watch and Learn

Debugging a Tricky Look-up Table Indexing Problem

Posted by Stuart McGarrity,

This morning I needed to debug an issue with a regularly used script. The code was converting numerical columns in a table to strings or categoricals by using a lookup table. I had a few levels of indirection which made it more complicated to understand what was going on. Breaking… read more >>

Use strlength to Detect Zero Length Strings

Posted by Stuart McGarrity,

You can’t use isempty to detect empty strings, as you would for character arrays, instead you should check for strlength being equal to zero or compare with an empty character vector. See the documentation for more information.
@media (min-width: 992px) { .containing-block { width: 100%; } }
Play the video in…

Modifying a Script to Track a datetime Duration Value 1

Posted by Stuart McGarrity,

Today I’m just making a small modification to an existing script to store a variable with the saveValue function I developed a while ago. The variable is of type duration, part of the recently added set of datetime functions.
Features used in this code-along style video include:

datetime and duration

@media (min-width: 992px)…

Some Uses of the MATLAB Function inputname 9

Posted by Stuart McGarrity,

Sometimes I need to display the name of a variable as a character array. This can help with the updating of variable names in code and automating the importing or exporting of multiple variables to data sources such as Excel. To do this I use the MATLAB function inputname in… read more >>

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