how to create incrementing arrays from each row of a matrix?
2 次查看(过去 30 天)
显示 更早的评论
I have a big table starts like this
A B
33 17
30 -4
26 14
25 14
I would like to get a new array containing the increments of the form (B:A) from each of the rows.
For instance (table.B(1):table.A(1)), (table.B(2):tableA(2)) and so on.
Is there a simple way to do this? Is a loop necessary?
Thank you
0 个评论
采纳的回答
madhan ravi
2020-6-2
编辑:madhan ravi
2020-6-2
indices = arrayfun(@(x) Table.B(x):Table.A(x),1:size(B,1),'un',0);
2 个评论
madhan ravi
2020-6-2
Note: Don’t name a variable named table you will shadow the inbuilt function table(...)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!