필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to solve INDEX OUT OF BOUNDS ERROR? Please help me. Stuck in this for the past 10 days.

조회 수: 1 (최근 30일)
eltn=30;
%%(b)Element Connectivity Table
count = 0 ;
conn = zeros([],3) ;
for i=1:30
for j=1:27
count = count+1 ;
conn(count,:) =[j,j+1,j+2]
end
end
%Here the Code for Assembling (OR) Global Mass Matrix
%x(i,j)=Kte_matrix(i,j); %DOUBT +=
for i=1:27
for j=1:27
MG_matrix(conn(eltn,i) - 1,conn(eltn,j) - 1)= Mte_matrix(i,j); (ERROR HERE)
end
end
How to convert conn matrix in this range??
Attempted to access conn(30,4); index out of bounds because size(conn)=[810,3].
Error in practisee2 (line 558) MG_matrix(conn(eltn,i) - 1,conn(eltn,j) - 1)= Mte_matrix(i,j);
  댓글 수: 11
Walter Roberson
Walter Roberson 2018년 11월 12일
That is quite different initialisation than what you had before.
Virajan Verma
Virajan Verma 2018년 11월 13일
That conn matrix is showing index out of bounds error as it has only 3 columns and for i>3, it has no elements to show. That is why i changed the initialization.

답변 (1개)

KSSV
KSSV 2018년 11월 12일
Check the function assemble in the link. This will help you.
  댓글 수: 8
Virajan Verma
Virajan Verma 2018년 11월 13일
The value of conn(eltn,j) for j=1 should be 59. How can it be zero??
Stephen23
Stephen23 2018년 11월 13일
편집: Stephen23 2018년 11월 13일
"The value of conn(eltn,j) for j=1 should be 59. How can it be zero??"
Who said that j is equal to one when that error occurs? I don't see anything in your code that means that j equals one when that error occurs. Try looking at the value of j after the error has occured, and you might just learn something about your code.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by