필터 지우기
필터 지우기

I tried this code but it doesn't work. Anyone can ans.it?Please.

조회 수: 1 (최근 30일)
Gemalyn Apostol
Gemalyn Apostol 2016년 10월 17일
편집: Gemalyn Apostol 2016년 10월 25일
Given A = [ 1 120; 1 130; 2 140; 3 180; 3 160 ] B = [ 1 91; 2 92; 3 93 ]
The first column in data A and B describe a key for the data. Now i want to "merge" the two data sets so that the result looks like targetdata = [ 1 120 91; 1 130 91; 2 140 92; 3 180 92; 3 160 93 ]
%Let be given three points A, B, C in the Euclidean plane. Determine the fourth point D on the line BC so that AD is orthogonal to BC.
i tried this code but it doesn't work.
cidx = bsxfun(@eq,DataA(:,1),DataB(:,1)');
m = 1:size(cidx,2)
DataA(cidx(:,m),3) = DataB(m,2);

답변 (1개)

Guillaume
Guillaume 2016년 10월 17일
This seems to be two completely different problems in the same question. I don't see how the first part (creating datatarget) relates to the second part (a geometry problem).
As this is homework, I won't give you the complete solution. Creating datatarget is trivial (just one line) using ismember
As for the geometry problem, this is also easy using vector projection.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by