From the Image, there are 15 internal points(A-O) and 20 outline points(1-20).
I want to collect data from each internal point to each outline points. That means i will have 15*20=300 data at the end.
I'm going to use 4 for loop to do it, but I think can use Matrix and array to simplify it.
Is there any solutions?
Here is my code
the problem is
- My code only can calculate for example,first round on point(1,1). the result i get is not only from 1,1 to each outline points but also form (1,1)to every internal point. I only want the distance form internal to outline…
- Is there any easy way to simplify to program as i want to increase the length and width of rectangular later. what if the length is 11 and width is 6,there will be 1700 data at end.
for x = 1:(a-1);for y = 1:(b-1);for m = 0:a;for n = 0:b; ratio = (y - n) / (x - m);sum = ((x - m)^ 2) +((y - n)^ 2);l = sum^0.5;X = sprintf('the distance between two points is %.2d', l);disp(X);if n == bend;endendendend
Best Answer