フィルターのクリア

I need to divide two matrix with different rows and column

6 ビュー (過去 30 日間)
rajasekar dhandapani
rajasekar dhandapani 2019 年 6 月 18 日
編集済み: Adam Danz 2019 年 6 月 19 日
Hi Everyone,
I have two Matrix
A= 1x12
B=11x12
I want to divide D=A(of 1st element) / B(of complete Row)
now D should have 11 Rows which all divided by 1st element in A
Is it possible to do with for loop?
Thanks a lot..!

採用された回答

Adam Danz
Adam Danz 2019 年 6 月 18 日
編集済み: Adam Danz 2019 年 6 月 18 日
Your description asks for two different things.
"I want to divide D=A(of 1st element) / B(of complete Row)"
% Fake data
A = randi(20,1,12);
B = randi(20,11,12);
D = A(1,1)./B
"D should have 11 Rows which all divided by 1st element in A"
D = B / A(1,1);
Or do you want to divide each column of A by the columns in B?
D = A ./ B;
  2 件のコメント
rajasekar dhandapani
rajasekar dhandapani 2019 年 6 月 18 日
編集済み: rajasekar dhandapani 2019 年 6 月 18 日
This only calculates 1 row.
Please find my data in the attachement.
A is 1X12 B is 11X12
Each number of columns in A should be divided by B and the result should also be in 11X12
For example D should look like
7.2 (which is 36.1/5.19) 5,6(which is 33,33/5,88) ..................
7.16 (which is 36,1/5,04) 5,56(Which is 33,33/5,99) ....................
. .
. .
so on
Adam Danz
Adam Danz 2019 年 6 月 18 日
編集済み: Adam Danz 2019 年 6 月 19 日
The fake data I created fits your description. Check out the last line in my answer. It does what you're describing. Here's another example
D = [1 2 3] ./ [1 1 1; 2 2 2; 3 3 3];

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by