Subtraction between a matrix and a column vector
12 ビュー (過去 30 日間)
古いコメントを表示
Akshay Vivek Panchwagh
2022 年 4 月 5 日
コメント済み: Akshay Vivek Panchwagh
2022 年 4 月 12 日
So I have a matrix of the size 23x15 and a column vector of size 23x1. I need to subtract element 1 of the colum vector from the 1st row of the matrix, element 2 of the column vector from 2nd row of the matrix, and so on. Any suggestions about how I can do it?
0 件のコメント
採用された回答
Riccardo Scorretti
2022 年 4 月 5 日
Hi. If the matrix and the vector have compatible size (= like you mentioned), it is enough to use the minus operator:
A = rand(23,15);
x = rand(23,1);
A-x
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!