Scalar Multiplication of different values at same time

2 ビュー (過去 30 日間)
Kanchibhotla Chandra Sekhar
Kanchibhotla Chandra Sekhar 2019 年 6 月 26 日
編集済み: per isakson 2019 年 6 月 27 日
I have a function -
[x1 x2 x3] = somefunction(y1,y2);
now i want to multiply the [x1 x2 x3] by scalar value z.
[x1 x2 x3] = [x1 x2 x3] .*z; % Want to do like this which is not valid as per the codde
instead of doing the multiplication individually i want to do the multiplication all at a time.
Is there any way to mulitiplication all at a time.

回答 (1 件)

madhan ravi
madhan ravi 2019 年 6 月 26 日
編集済み: madhan ravi 2019 年 6 月 26 日
Assign the values with one output for instance as variable X which consists all the values in it.
  6 件のコメント
Kanchibhotla Chandra Sekhar
Kanchibhotla Chandra Sekhar 2019 年 6 月 26 日
My goal is simple -
i have function with has three different values -
[x1, x2, x3] = somefun(y1,y2);
now i want to do salar multiplication to x1, x2, x3 which are individual variables and want to do the scalar multiplication all at time.
Like this -
[x1, x2, x3] = [x1, x2, x3].*z; % where z is scalar value
which is not possible since the assignment of variable to different variables all at a time.
Is there any possibility to multipliy the variables all at a time.
per isakson
per isakson 2019 年 6 月 27 日
編集済み: per isakson 2019 年 6 月 27 日
AFAIK: NO! However, some do weird tricks with subsref and subsasgn.

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

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by