fast array substitution

版本 1.1.0.0 (1.7 KB) 作者: Ondrej Budac
a function to substitute entries of an array using rules From(i) -> To(i)
123.0 次下载
更新时间 2014/7/1

查看许可证

Given a numerical array A and two arrays From and To of equal size, we would like to make substitution From(i)->To(i) in the array A for every i.
If the number of values to substitutes (numel(From)) is small, one can use a vectorized code to substitute the values one-by-one. However, this is too costy if there are too many substitutions. In this case, the provided function uses a different algorithm. It sorts the array A and the substitution rules and then it does one non-vectorized sweep of the inputs. Finally, we restore the original order and shape of A.

引用格式

Ondrej Budac (2025). fast array substitution (https://www.mathworks.com/matlabcentral/fileexchange/47101-fast-array-substitution), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2014a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.1.0.0

added an icon

1.0.0.0