How to divide a line into several parts and obtain the coordinates?
Show older comments
Hi, I want to create a small script that can allow me to divide a line into segments and then retrieve me the coordinates of the new points. The line is vertical so I only need the 'y' values. I create the following, but I don't know how to make the scrip save me all the results of the loop in one matrix, it just save me the last one. Here is the script:
B=[9 3]; % first point
E=[9 10]; % second point
BE=E(2)-B(2); % distance between the two points in y
No_lam=input('Enter # of laminas:');
l=BE/No_lam;
Bi=(B(2))-l;
New=[];
for n=0:No_lam
Bi=[Bi+l]
end
I will appreciate some help with this. Martha
Accepted Answer
More Answers (1)
Iain
on 21 Aug 2014
This roughly what you're looking for?
for i= 1:number_of_iterations
B(i) = Bi + i*l;
end
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!