index exceeds matix error

조회 수: 1 (최근 30일)
Ram Siddardha
Ram Siddardha 2014년 1월 26일
답변: Amit 2014년 1월 30일
hi, i have created a mesh in a software and want to upload that into matlab using NIRFAST software, when i upload my node and element files into matlab an error occurs showing that index exceeds the matrix. To give you guys a clear view node file is a NX4 matrix and my elem file a EX4 matrix. N,E are the number of nodes and elements. where do you think the problem may lie. I am new to matlab please help me.
regards, ram
  댓글 수: 4
Ram Siddardha
Ram Siddardha 2014년 1월 30일
Index exceeds matrix dimensions.
Error in mytsearchn (line 89) dist = (mesh.nodes(:,1:3)-repmat(coord(i,1:3),size(mesh.nodes(:,1:3),1),1)).^2;
Error in load_mesh (line 386) [ind,int_func] = mytsearchn(mesh,mesh.meas.coord);
Error in gui_load_mesh>done_Callback (line 114) evalin('base',content{end});
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in gui_load_mesh (line 42) gui_mainfcn(gui_State, varargin{:});
Error while evaluating uicontrol Callback
Ram Siddardha
Ram Siddardha 2014년 1월 30일
I am actually importing a finite element mesh into MATLAB. To do that i need to import node and elements file of the mesh and i am getting this error when i do that. I dont really understand where and what to change to eliminate this problem.. My node file has a matrix of 324X4 My elem file is of the order 1172 X 4

댓글을 달려면 로그인하십시오.

답변 (1개)

Amit
Amit 2014년 1월 30일
(mesh.nodes(:,1:3)-repmat(coord(i,1:3),size(mesh.nodes(:,1:3),1),1)).^2;
The code should work unless coord or mesh.nodes have less than 3 columns. That is where I see this error thrown.
Before going in the loops, check
size(mesh.nodes,2)
size(coord,2)
and make sure that you get a number 3 or bigger than 3 for both of them.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by