|
|
| File Information |
| Description |
reindex(x,y) adds dimensions without the confusion of reshape. It makes x look like y. For example:
x = ones([1 5]);
y = ones([6 5 9]);
z = y + x; %this fails
z = y + reindex(x,y); %but this does not
Works for arbitrary dimensions, as long as all non-singleton dimensions of x are also dimension of y.
reindex is more general than bsxfun (though maybe slower), because it can do repmat and permute without much thought from user:
x = zeros([5 9]);
y = ones([3 5 1 9 2]);
z = bsxfun(@minus,y,x)); %fails because dimensions don't match
z = y-reindex(x,y); %works, z has dimension of y |
| MATLAB release |
MATLAB 7.3 (R2006b)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (1) |
| 26 Nov 2007 |
John D'Errico
|
|
|
| Updates |
| 28 Nov 2007 |
Address review, clarify use of function |
|
Contact us at files@mathworks.com