How to automate a process?
조회 수: 2 (최근 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일
The question is not clear. Are the functions "Orientation" and "Orientare" identical?
채택된 답변
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!