Loren on the Art of MATLAB

Turn ideas into MATLAB

Note

Loren on the Art of MATLAB has been archived and will not be updated.

Results for: Cell Arrays

Which Way to Compute: cellfun or for-loop? 9

Over a long number of years, people have asked whether it's better to use cellfun or a for-loop to perform certain computations. As with so many things in life, the correct answer here is "it depends". Let me give you a bit more insight so you can make good choices.... read more >>

Partitioning a Vector 9

Recently on the MATLAB newsgroup, there was a thread asking how to split up a vector into pieces which were each monotonically increasing by the value 1. The post got several answers which I did not read first. Here's my thinking.... read more >>

Dealing with Cells 37

A customer recently asked me this question at the MATLAB Virtual Conference. Contents ... read more >>

Optional Arguments Using Empty as Placeholder 11

I recently posted about optional input arguments and how to override default values. Gautam mentioned wanting to allow empty inputs as defaults. Contents ... read more >>

Nice Way to Set Function Defaults 40

Last week, I wrote a post on the switch statement in MATLAB. One theme in the comments was about using switch (or not!) for setting default values for input arguments that users didn't initialize. I realized that there is a nice pattern for setting these values that uses some compact, but readable code.... read more >>

Deal or No Deal 21

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... read more >>

Cell Arrays and Their Contents 117

I've written several blog articles so far on structures, and not quite so much on their soulmates, cell arrays. Just last week, at the annual MathWorks Aerospace Defense Conference (MADC), I had... read more >>