what dos this instruction mean

i meet this instruction when analyzing a matlab file could you help me what does it mean ?
yone=(y==i)+(y~=i)*-1;
when y is a column vector and i is fix number i=4;
what will be the size of yone in this case ?

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 5 月 16 日

0 投票

A value of "1" where the entries are "i", and a value of "-1" where the entries are not "i", and 0 where the entries are NaN.

1 件のコメント

Jan
Jan 2013 年 5 月 16 日
Equivalent:
yone = 2 * (y==i) - 1;

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

カテゴリ

ヘルプ センター および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

質問済み:

2013 年 5 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by