Loren on the Art of MATLAB

Turn ideas into MATLAB

Results for: Indexing

Deal or No Deal 21

Posted by Loren Shure,

This post continues in the theme from my last post, where people routinely come to me on a topic. Today I want to distinguish
between indexed assignment, where you can take advantage of scalar expansion, and assignment to several output arrays, often
arising from a comma-separated list from cell or struct arrays.... read more >>

A Way to Account for Missing Data 15

Posted by Loren Shure,

MATLAB has the concept of Not-a-Number, also known as NaN for quite some time. Following the IEEE 754 Standard for Binary Floating-Point Arithmetic, some floating point calculations result in NaN, for example, 0/0. You can also use them as placeholders in numeric arrays, for example to denote missing data. If... read more >>

Reversal of a sort 24

Posted by Loren Shure,

We can sometimes be motivated to reverse things in Boston. And I occasionally get asked how to reverse the sort direction from MATLAB. So instead of sorting A and then having B follow the new order, let's undo a sorting operation, and in a way that multiple vectors... read more >>

Essence of Indexing 14

Posted by Loren Shure,

Indexing into arrays allows you to address portions of the elements of an array and treat this subset as an array itself, whether for calculations or input to other functions (essentially a right-hand side) or for assignment (left-hand side). ... read more >>