Run every element through a function and return a new array
1 次查看(过去 30 天)
显示 更早的评论
Hi, I have a 1000x1 table and I want to run every row through a function y=a*x+b-1 where a and be are constants, and x are the elements from the table. The result should be a new 1000x1 table. Can anybody help?
Cheers.
0 个评论
采纳的回答
Adam
2017-11-16
doc rowfun
using
func = @(x) a*x + b - 1;
should work for this provided a and b are already defined at the point you include the definition of func.
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!