配列内の要素を行ごと​に演算する方法を教え​てください

69 visualizaciones (últimos 30 días)
SH
SH el 19 de Feb. de 2018
Respondida: Yoshio el 20 de Feb. de 2018
例えば、下記配列A
A
3 6
4 2
8 1
6 3
7 3
を配列B
B=
1行目1列目÷1行目2列目
2行目1列目÷2行目2列目
3行目1列目÷3行目2列目
4行目1列目÷4行目2列目
5行目1列目÷5行目2列目
を配列Bに格納する方法が知りたいです。
B=
3/6
4/2
8/1
6/3
7/3
  1 comentario
SH
SH el 19 de Feb. de 2018
Aは5×2、Bは5×1の行列です

Iniciar sesión para comentar.

Respuesta aceptada

Jiro Doke
Jiro Doke el 19 de Feb. de 2018
こんな感じでいかがでしょう
B = A(:,1) ./ A(:,2)
※ 解釈: A の1列目 ÷ A の2列目
  1 comentario
SH
SH el 20 de Feb. de 2018
ありがとうございます。

Iniciar sesión para comentar.

Más respuestas (1)

Yoshio
Yoshio el 20 de Feb. de 2018
是非無償で利用できる MATLAB 入門 https://jp.mathworks.com/training-schedule/matlab-onramp.html を使って勉強してみてください。2時間やってみると、お尋ねの質問は自分で解けるようになります。

Categorías

Más información sobre 算術演算 en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!