MATLAB: Unable to use a value of type matlab.gra​phics.prim​itive.Line as an index. How do i fix this

errorMATLAB

fodo=[ 1 1 2.5 0 ;
5 1 1.0 0 ;
1 1 1.5 0 ;
4 1 2.0 60;
1 1 1.5 0 ;
5 1 1.0 0 ;
1 1 2.5 0 ]
ring=repmat(fodo,6,1);
beamline=repmat(fodo,6,1)
dv=[0;0;beamline(line,3)]; dw=eye(3);
Unable to use a value of type matlab.graphics.primitive.Line as an index.

Best Answer

'line' is MATLAB's built-in function. You haven't defined it as something else in your code. Therefore, the statement
beamline(line,3)
causes error.