How to automate a process?
1 view (last 30 days)
Show older comments
- Note: English is not my first language and I may be not very explicit.
I have the input data:- matrix A(3,2)=[683265.032 465089.623; 683248.660 464977.521; 683303.746 465039.114].
-_Function ,,Orientation"_ which contains this formula: *atan((B(1,2)-A(1,2))/(B(1,1)-A(1,1)))*200/pi*.
And this matrix B(3,3)-output data: B=[-1 Orientation(A(1,:),A(2,:)) Orientation(A(1,:),A(3,:)); Orientation(A(2,:),A(1,:)) -1 Orientation(A(2,:),A(3,:)); Orientation(A(3,:),A(1,:)) Orientation(A(3,:),A(2,:)) -1];
- "-1" means that Orientation to the same point can't be calculated.
So far so good by now. But what if I want to add 2 more rows of coordinates in matrix A? I want matrix B to calculate, using function "Orientation", regardless of how many sets of coordinates matrix A contains (rows). I don't want to write manually the commands in B every time I add new data to A. It is possible to automate this process?
2 Comments
Jan
on 2 May 2013
The question is not clear. Are the functions "Orientation" and "Orientare" identical?
Accepted Answer
Jan
on 2 May 2013
I do not understand the question completely. Perhaps you are looking for:
function R = Orientation(A, B)
R = atan((B(:, 2) - A(:, 2)) ./ (B(:,1) - A(:,1))) * (200/pi);
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!