필터 지우기
필터 지우기

one column of data manipulating the other.

조회 수: 1 (최근 30일)
charles atlas
charles atlas 2012년 5월 9일
I have two columns of data as such:
c1 = [1 3 5 9 13];
I have another column of data as such:
c2 = [34 65 79 134];
I want to have each value in c1 to subtract each value from it in c2. As in, I want 1-34, 1-65, 1-79, 1-134. This will generate a matrix that is the 4 rows of data that is 5 columns long with the answers to every calue in c1 minus each individual value in c2

채택된 답변

Oleg Komarov
Oleg Komarov 2012년 5월 9일
c1 = [ 1 3 5 9 13];
c2 = [34 65 79 134];
bsxfun(@minus, c1,c2')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by