trailPadding

版本 1.0.0 (33.4 KB) 作者: Anmol Pardeshi
padding an array at trails
13.0 次下载
更新时间 2020/7/9

查看许可证

inputs:
1. array to be padded (double only)
2. length to be achieved after padding (double only)
3. value of the pad (eg: use 0 if zero padding is required) (double only)
4. where to pad? options (a) pre (attach padding before the array) (b) post (attach padding after the array) (c) both (attach padding before and after *) (string only)
output: padded array (double)
process:
many times we have arrays of different length but need to pad them in such a way that the final length of all the arrays are the same. So we need an adaptive function here that adapts to the current length, calculated the padding elements required to make it to the final length. The function here does the same but it is more robust. User can choose to add the padding either before or after the array.
* - but in CNN projects, user may need to add padding on both sides of the image (above and below not considered here). So the user can iterate through the image rows and use this function to add EVEN padding on both sides. If the user enters the final length such that the number of padding elements required (to achieve the the final length) are ODD number of elements, it throws error (because the function cannot know where to place more elements than the other).

引用格式

Anmol Pardeshi (2024). trailPadding (https://www.mathworks.com/matlabcentral/fileexchange/77969-trailpadding), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2017a
兼容任何版本
平台兼容性
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