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])
引用格式
Yuxin Jiang (2024). conform_dims(dims,x,ndim) (https://www.mathworks.com/matlabcentral/fileexchange/63295-conform_dims-dims-x-ndim), MATLAB Central File Exchange. 检索来源 .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0.0 |