how to create incrementing arrays from each row of a matrix?
조회 수: 3 (최근 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!