Too many output arguments.

Hi, I am new to matlab and I need help.
Im tring to scale my x vectors by 2 and y vectors by 4.
both x vector and y vecotr has dimension of 1x1000.
the code is below
[c,d]= [2 0;0 4]*[x;y];
when I run the code, I get an error of too many outputs.
Thank you in advance

回答 (2 件)

James Tursa
James Tursa 2019 年 10 月 3 日

0 投票

Why not just
c = 2*x;
d = 4*y;

1 件のコメント

Byungchang Kim
Byungchang Kim 2019 年 10 月 3 日
My professor told me to use the matrix multiplication to solve the problem so I don't think I can.

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

Walter Roberson
Walter Roberson 2019 年 10 月 3 日

0 投票

You cannot do that in MATLAB. The mtimes operator (the formal name for the * operator) only creates a single output argument. You will have to assign the output to a single variable and break apart that single variable into the part representing the new x and the part representing the new y.

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2019 年 10 月 3 日

回答済み:

2019 年 10 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by