I tried this code but it doesn't work. Anyone can ans.it?Please.
1 view (last 30 days)
Show older comments
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);
0 Comments
Answers (1)
Guillaume
on 17 Oct 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
0 Comments
See Also
Categories
Find more on Startup and Shutdown 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!