Create an array from other array

54 ビュー (過去 30 日間)
luca
luca 2019 年 10 月 8 日
コメント済み: luca 2019 年 10 月 8 日
Given the following arrays
V = [310 285 334 302 306 312 316 304 305 291 310];
M= [273.381 245.231 203.334 212.814 239.183 276.148 231.269 291.846 258.205 276.486 236.715];
I want to create an array
x = [ -310 -273.381 ; -285 -245.231; -334 -203.334 ; -302 -212.814 ;-306 -239.183 ;-312 -276.148 ; -316 -231.269 ; -304 -291.846;-305 -258.205; -291 -276.486 ; -310 -236.715];
that take the value in each column and create a new row in x, changing in negative all the values.
May some could help me?

採用された回答

Fabio Freschi
Fabio Freschi 2019 年 10 月 8 日
編集済み: Fabio Freschi 2019 年 10 月 8 日
x = [-V(:) -M(:)];
The column operator here reshapes the vector into a column vector
  1 件のコメント
luca
luca 2019 年 10 月 8 日
Grazie Fabio

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by