Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
Gemalyn Apostol
Gemalyn Apostol am 17 Okt. 2016
Bearbeitet: Gemalyn Apostol am 25 Okt. 2016
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);

Antworten (1)

Guillaume
Guillaume am 17 Okt. 2016
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.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by