Skip to content

Instantly share code, notes, and snippets.

@lup-
Last active August 29, 2015 14:04
Show Gist options
  • Save lup-/932f97e8f9a237eee39e to your computer and use it in GitHub Desktop.
Save lup-/932f97e8f9a237eee39e to your computer and use it in GitHub Desktop.
Factor product, умножение факторов
xy=[1 1 0.7;1 2 0.1;2 1 0.4;2 2 0.1]
yz=[1 1 0.2;1 2 0.8;1 3 0.5;2 1 0.0;2 2 0.9;2 3 0.3]
xyz=[];
for i=1:size(xy,1)
yzf = yz( yz(:,1)==xy(i,2), : );
rmxy = repmat( xy(i,:),size(yzf, 1),1 );
xyz = [xyz; rmxy(:,1:2) yzf(:,2) rmxy(:,3).*yzf(:,3)];
end
xyz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment