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.

Posts 21 - 30 of 66

Results for: Best Practice

Ensuring Positive Values – Part 1 4

Do you sometimes need to be sure an array has only bounded, positive values? At least one customer asked about this recently and noted that it could be quite involved. ... read more >>

Handling Discrete Data

Discrete data arise in many applications and the data may be numeric, or non-numeric, often referred to as categorical. Not all data are strictly numeric, and other... read more >>

Using parfor Loops: Getting Up and Running 81

Note. NOTE: matlabpool was removed in 2015 and you should replace that with parpool instead. Today I’d like to introduce a guest blogger, Sarah Wait... read more >>

MATLAB Release 2009b – Best New Feature or ~? 53

MATLAB R2009b was recently released. My favorite new language feature is the introduction of the ~ notation to denote missing inputs in function declarations, and missing outputs in... read more >>

Find Largest Positive Value Next to Zero 19

Recently, Steve wrote a blog discussing code clarity/obscurity in the context of one-line code solutions. Simply stated, the problem he solved is this. Find the largest value in an... 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 >>

Convenient nargout Behavior 8

Here's a question that was recently posed at MathWorks. I'm trying to invoke a function handle. It either returns 0 or 1 output arguments. If it returns an output ... read more >>

Nested Timing 2

Did you know that you can use tic and toc to measure times of operations that may have other timed operations nested inside? Contents ... read more >>

New Ways With Random Numbers, Part II 22

Once again we're going to hear from guest blogger Peter Perkins, who is a statistical software developer here at The MathWorks. Contents ... read more >>

Posts 21 - 30 of 66