conform_dims(dims,x,ndim)
Repmat a vector/matrix so that it conforms to the shape of the given dimension sizes.
Similar with conform_dims in NCL http://www.ncl.ucar.edu/Document/Functions/Built-in/conform_dims.shtml
Usage:
output = conform_dims(dims,x,ndim)
dims: An array of dimension sizes of which x will be conformed to.
x: a vector/matrix whose dimensions must be a subset of dims.
ndim: An array of dimension indexes to indicate which dimension sizes
indicated by dims match the dimensions in x. The leftmost dimension index is 1.
Example:
h2d = rand(2,3);
h3d = rand(2,3,4);
y = [1;2;3];
y2d = conform_dims(size(h2d),y,2)
y3d = conform_dims(size(h3d),y,2)
y3d = conform_dims(size(h3d),y2d,[1 2])
Cite As
Yuxin Jiang (2024). conform_dims(dims,x,ndim) (https://www.mathworks.com/matlabcentral/fileexchange/63295-conform_dims-dims-x-ndim), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |