MATLAB Answers

Translated by

이 페이지의 내용은 영어에서 자동 번역되었습니다. 자동 번역 기능을 해제하려면 "<a class="turn_off_mt" href="#">여기</a>"를 클릭하십시오.

0

How to generate all pairwise differences between two vectors

Asked by Tamir Eisenstein on 6 Feb 2019
Latest activity Answered by Andrei Bobrov
on 15 Feb 2019
Hi,
how can I generate a new vector of all the pairwise differences between two existing vectors?
thanks,
Tamir

  0 Comments

Sign in to comment.

4 Answers

Answer by Andrei Bobrov
on 6 Feb 2019

out = a(:) - b(:)';

  0 Comments

Sign in to comment.


Answer by Tamir Eisenstein on 7 Feb 2019

Thanks Andrei!

  0 Comments

Sign in to comment.


Answer by Tamir Eisenstein on 15 Feb 2019
Edited by Tamir Eisenstein on 15 Feb 2019

Hi Andrei, I have a small follow-up question:
How can I generate each difference value in "out" to be a percentage from b [i.e ((a-b)/b)*100 ] and not as a "raw" value?
Thanks!
Tamir

  0 Comments

Sign in to comment.


Answer by Andrei Bobrov
on 15 Feb 2019

out = (a(:)' - b(:))./b(:)*100;

  0 Comments

Sign in to comment.



Translated by