Closed shihan-ma closed 3 years ago
@shihan-ma, I don't use msh file myself. but using reg(k)
makes it possible to make the actual labels in the file. doesn't your change removes the old label and renumber those sequentially?
The savemsh function failed when used in the sample scripts and in my stl to mesh script. I found out that the region id is numbered from 0 in elem. However, Matlab indices start from 1. Using M.Regions.name{reg(k)} causes an error. I guess it could be fixed by simply add 1 to reg(k). If the old labels are numbered in sequence, reg(k)+1 and k will be the same.
hi @shihan-ma, if the issue is the presence of 0-label (tetgen assigns regions a 0 label if it is not region seed defined), then, a proper fix is to replace it with a non-zero label (perhaps max(label)+1).
if you add all labels by 1, then the numbering will not match the desired region label according to the region seeds.
I think inserting the following line before the for-loop should fix the problem, do you agree?
reg(reg==0)=max(reg)+1;
Fix the index error when building the table of regions.