How can I make different matrices for different values from other matrices?

1 view (last 30 days)
Marvin Brown
Marvin Brown on 30 Nov 2021
So I have 2 arrays, one containing a bunch of x-coordinates and the other containing a bunch of y-coordinates. They're all in order, such as xco(1,1) is the x-coordinate that pairs with yco(1,1) {Which is the array of y-coordinates}. I would like to pair xco(1,1) and yco(1,1) into a single matrix listing the propper x and y coordinates in a neat display. The issue is the number of x and y coordinates are variable based on user inputs and expressions coded earlier in the program. So for each time a user uses the program the number of x and y coordinates will vary. But I want all the coordinates to show up in one matrix without having to explicitly code them in, which wouldn't work anyways because the number of coordinates vary with each run of the program.
Here is some of the code I've written so far:
for a = 1:holes;
angles = ameasure*a;
A(a)=angles;
end
%Now to find the distance in the x-corrdinate away from the center for each hole
xco = cosd(A)*radius;
%This function represents the distance away from the center in the y-coordinate for each hole
yco = sind(A)*radius;
%Now that we have all the values of each hole calculated, let's put them
%in a more user-friendly display

Answers (0)

Community Treasure Hunt

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

Start Hunting!