how to modify all elements in a row vector
显示 更早的评论
Hello I wanted to ask if I have a row vector and I want to medofy each element of the vector in such way that element 1 is equal to (element 1 *0), and element2= (element2*1) and element3= (element3*2) and so on. is possible to implement this is matlab? do I need a loop?
采纳的回答
更多回答(1 个)
madhan ravi
2020-8-13
vector(:) .*(0:numel(vector(:)) - 1)
1 个评论
madhan ravi
2020-8-13
Are you trying to finish your homework by making others do it? Start with MATLAB On-ramp.
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!