Info
此问题已关闭。 请重新打开它进行编辑或回答。
Could someone write some code to extract details within a for loop?
1 次查看(过去 30 天)
显示 更早的评论
In my previous post, I was given some code that works great, but I need to extract some details that are mentioned within one of the for-loops, namely:
- arc lengths
- arc radii
- starting/ending points of arcs (triplet center points)
- thetas (w/ corresponding theta1, theta2 angles) for each arc.
Can anyone help me to extract and store these details (along with index/node numbers) within a single variable/file?
Thanks in advance for your help!
回答(1 个)
Catalytic
2019-11-21
编辑:Catalytic
2019-11-21
Something like this....
function stuff=getStuff(tgraph,arcNumber)
AP=tgraph.ArcPoints;
i=arcNumber;
C1=AP(:,1,i); C2=AP(:,4,i);
V1=AP(:,2,i); V2=AP(:,3,i);
L=norm(C2-C1);
U=(C2-C1)/L;
dV1=(V1-C1)/norm(V1-C1);
dV2=(V2-C2)/norm(V2-C2);
stuff.theta1=acosd(dot( dV1, U) );
stuff.theta2=acosd(dot( dV2, -U) );
stuff.theta=(theta1+theta2)/2;
stuff.arcradius=norm(C1-C2)/(2*sind(theta));
stuff.C1=C1;
stuff.C2=C2;
stuff.nodeNumber=findedge(tgraph.Cgraph,i);
end
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!