"index exceeds matrix dimensions" error
이전 댓글 표시
What can I change on the quickersim routine (see attached importMeshGmsh.m) so that I can import a gmsh file (see attached reactor2.gmsh file) into matlab.
When I try, I get the "index exceeds matrix dimensions" error.
The error is in importMeshGmsh (line 114) p(1:3,i) = [abcd(2:4)]';
Regards
댓글 수: 7
KSSV
2017년 8월 7일
At line 6....you have: 1 43 ''1''...but code is expecting four numbers from this line.....where as the file has only two...so the error....
Dursman Mchabe
2017년 8월 7일
Walter Roberson
2017년 8월 7일
The file does not appear to be attached?
Samuel Jacobs
2017년 8월 17일
Same, would you be able to maybe paste in the code or reattach. I am having the exact same issue. Thanks in advance.
basically no need to change the root code, just in the gmesh program ,always try to name the surfaces first then the lines. just be sure to check it by ctrl+shift+v (all the things named will be present there).
after naming & generating the mesh, export it and open it in wordpad. and just delete the anything followed in between the $physicalnames and $EndPhysicalNames
_$PhysicalNames
4
1 3 "My second line"
1 5 "My third line "
2 6 "My surface"
3 1 "The volume"
$EndPhysicalNames_
save the file and then run it on matlab.... although its a bit cumbersome but it works for me.... :)
Jeremy Marston
2018년 3월 22일
편집: Walter Roberson
2018년 3월 26일
I also got this error message and found by deleting the text between $physicalnames and $EndPhysicalNames, this error message goes away. However, I then encountered a NEW error as follows:
Error using ==
Matrix dimensions must agree.
Error in importMeshGmsh (line 202)
if(sum(t([1 2],el)'==[n1 n2])~=2 && sum(t([2 3],el)'==[n1 n2])~=2 && sum(t([3
1],el)'==[n1 n2])~=2)
Error in ID_Pen (line 7)
[p,e,t] = importMeshGmsh('taper_1.msh');
One thing I noticed is that in the tutorial files, the number of elements is precisely double the number of nodes, whereas in my own msh file, they are the same...!
Can anyone help me fix this ?
Walter Roberson
2018년 3월 26일
As the original importMeshGmsh is no longer attached, this question would appear to relate to the Gmsh toolbox, http://gmsh.info/doc/texinfo/gmsh.html . However, we would probably need to know which version of the code you are using, and an example file would help.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Number Theory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!