Code covered by the BSD License  

Highlights from
Rectify matrix sizes

Be the first to rate this file! 0 Downloads (last 30 days) File Size: 1.78 KB File ID: #12634

Rectify matrix sizes

by Jeff Dunne

 

13 Oct 2006 (Updated 16 Oct 2006)

Rectify ensures uniform sizes for matrices

| Watch this File

File Information
Description

RECTIFY takes a set of input matrices and produces as output a set of REPMAT'ed matrices such that all matrices have the same dimensions. This is similar to NDGRID is some respects, but the inputs are not just vectors of values to expand (although it can be used that way).

For example,

a = [0 1 2 3 4 5
     6 7 8 9 10 11];
b = [11 12
     13 14
     15 16
     17 18];

[A,B] = RECTIFY(a,b);

produces:

A = [0 1 2 3 4 5
     6 7 8 9 10 11
     0 1 2 3 4 5
     6 7 8 9 10 11];

and

B = [11 12 11 12 11 12
     13 14 13 14 13 14
     15 16 15 16 15 16
     17 18 17 18 17 18];

This function is most useful when creating high order matrices of input combinations for vectorized functions.

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
matrices Jeff Dunne 22 Oct 2008 08:43:48
repmat adjust matrix size Jeff Dunne 22 Oct 2008 08:43:48

Contact us at files@mathworks.com