Subtracting a column from an array.

3 ビュー (過去 30 日間)
eagleeye90
eagleeye90 2016 年 3 月 10 日
コメント済み: eagleeye90 2016 年 3 月 10 日
I have an array of data (eg X = 2185:10/1718.5:2195) and I want to subtract each value of the X with every value of a column matrix (size 1719*1). For the simplification purposes,let us assume my column matrix is with a size of 4*1 and contains values such as [2185.00295;2185.00446;2185.00167;2185.02910]. I would like to get my results in the following manner:
results in first row :(2185:10/1719:2195)-2185.00295 results in second row: (2185:10/1719:2195)-2185.00446 results in final row: (2185:10/1719:2195)-2185.02910. How can I get this done? I hope my explanation of the question is understandable.

採用された回答

Ahmet Cecen
Ahmet Cecen 2016 年 3 月 10 日
RESULT = bsxfun(@minus, MATRIX, COLUMN_VECTOR)
  1 件のコメント
eagleeye90
eagleeye90 2016 年 3 月 10 日
Thank you !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by