calling all the elements of a matrix consecutively
조회 수: 1 (최근 30일)
이전 댓글 표시
I need to call every element of a vector consecutively except the 'i' element I'm on. for example if i am using two for loops and my vector is V = [1,2,3,4,5]
[n,m]=size(V)
for i=1:m
for j=1:m-1
when i=1, i need to call 2 then 3 then 4 then 5
but for example when i=4, I need to call 1 then 2 then 3 then 5
I need this to work for any size vector because i am going to try to implement this in my Lagrangian polynomial interpolation function.
so again an example for i=3, my four j's in the second for loop should be 1 then 2 then 4 then 5
댓글 수: 3
채택된 답변
Azzi Abdelmalek
2013년 10월 27일
편집: Azzi Abdelmalek
2013년 10월 27일
V = [ 1 4 9 5]
for ii=1:numel(V)
q=V;
q(ii)=[]
for jj=q
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!