Code covered by the BSD License  

Highlights from
SLM

4.66667

4.7 | 4 ratings Rate this file 0 Downloads (last 30 days) File Size: 1.58 KB File ID: #10031

SLM

by Jos (10584)

 

16 Feb 2006 (Updated 17 Feb 2006)

special linear matrix

| Watch this File

File Information
Description

SLM creates a special matrix in which each element is the same as its linear index.
I know, it's quite simple, but such a matrix is often useful during algorithm development.
It has exactly the same calling index as <ones>, <rand> etc.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
17 Feb 2006 Duane Hanselman

Why not just use the standard one-liner:
reshape(1:N,i,j,...) or reshape(1:N,[i j ...])
This is very easy to understand visually, perhaps more so that remembering what SLM stands for?

17 Feb 2006 Jos van der Geest

Duane, I know it's as simple as that. You can always rename it (as I often do with FEX files).
I like that its calling syntax is like ones and gives the same errors when called erroneously. Moreover, you don't need to calculate N, as in reshape ...
Also I do not see why you give this a one-star rating, besides its simpleness ...

17 Feb 2006 Jiro Doke

I like the use of consistent syntax as the other built-in matlab functions. Clever how you made the error message to be consistent as well. And you used 'mfilename' so that people can rename the function without affecting the functionality.

17 Feb 2006 Duane Hanselman

I meant to hit the N/A button, but the 1 button is right next to it and now I can't undo it. You code is very well documented and written. Excelling at those two things makes it a very good submission.

17 Feb 2006 urs (us) schwarz

nice one-line engine... in charming, bloated disguise
in summary, welcome to another member of the family of pedestrians...
us

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
matrices Jos (10584) 22 Oct 2008 08:15:59
utility Jos (10584) 24 Oct 2008 15:37:29
linear Jos (10584) 24 Oct 2008 15:37:29
gallery Jos (10584) 24 Oct 2008 15:37:29
special Jos (10584) 24 Oct 2008 15:37:29
easy Jos (10584) 24 Oct 2008 15:37:29
reshape Jos (10584) 24 Oct 2008 15:37:29
matrix Jos (10584) 24 Oct 2008 15:37:29

Contact us at files@mathworks.com