Truble codeing a diamond lattice

24 views (last 30 days)
William
William on 23 Jun 2022
Commented: William on 24 Jun 2022
Hello, I have a problem with codeing a diamond lattice. I found a script for this porpouse that I would like to try but when I run it it says "error: 'diamondLattice' undefined near line 30, column 15". Is there somthing I need to change or add? Not really sure how to define the "diamondLattice". All help is vary much appreciated. I will share the skript and the link to it below. Thank you.
fontSize=15;
faceAlpha1=0.8;
faceAlpha2=1;
edgeColor=0.25*ones(1,3);
edgeWidth=1.5;
markerSize=25;
markerSize2=10;
cMap=gjet(4);
%Latticeparameters
nRepeat=3; %Number of repetitions of the lattice pattern
sampleSize=30;
nSubPenta=1;
strutThickness=2; %Set the strut thickness
[Ep,Et,VT,Ct]=diamondLattice(sampleSize,nRepeat,strutThickness,0);
[Ep,VT]=subPenta(Ep,VT,nSubPenta,3); %Sub-divide pentahedra
% strutThicknessCheck=mean(patchEdgeLengths(Fp{1},VT));
%Get element faces for visualization
Fp=element2patch(Ep,[],'penta6');
Ft=element2patch(Et,[],'tet4');
cFigure;
subplot(1,2,1); hold on;
gpatch(Fp,VT,'bw','none',1);
gpatch(Ft,VT,'bw','none',1);
axisGeom; camlight headlight;
subplot(1,2,2); hold on;
hpl=gpatch(Fp,VT,'rw','r',0.5);
hpl(end+1)=gpatch(Ft,VT,'gw','g',0.5);
legend(hpl,{'Pentahedral triangles','Pentahedra quads','Tetrahedral triangles'});
axisGeom; camlight headlight;
drawnow;
https://www.gibboncode.org/html/HELP_diamondLattice.html

Accepted Answer

Karim
Karim on 23 Jun 2022
You need the additional subroutines. In this case "diamondLattice.m" and all other routines accompined by it...
After a quick bit of googling it would seem that you need to download the following toolset: gibbonCode/GIBBON: The Geometry and Image-Based Bioengineering add-On for MATLAB (github.com) and add it to the matlab path.
Afterwards, the example runs fine.
  1 Comment
William
William on 24 Jun 2022
Thank you vary much, I will try that!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!