フィルターのクリア

A self assignment from scalar product

2 ビュー (過去 30 日間)
Damiano Capocci
Damiano Capocci 2018 年 1 月 17 日
編集済み: Damiano Capocci 2018 年 1 月 17 日
Hi there, i want to have a variable x which is involved in a scalar product with another vector but the result becomes an element of x itself. I 've tried this code ( I DON'T WANT TO USE FOR LOOP ):
x=ones([1,20]);
j=primes(100);
j=j(20);
a=1:20;
x(a+1)=x*j(randperm(20))'
But the result is :
x =
1 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71 71
It seems the product operation is executed before the assignament. How should I do?

回答 (0 件)

カテゴリ

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