How to automate a process?
1 次查看(过去 30 天)
显示 更早的评论
- 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 个评论
采纳的回答
Jan
2013-5-2
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);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!