I have a double vector of zeros; lets call it A which will be like;
A=[0,0,0,0,0,0,0,0,0,0,0,...,0]
I want to make specific rows as one for example if B=[2,6,7] are the row index that I want as one the result would be someting like;
Anew=[0,1,0,0,0,1,1,0,0,0,...,0]

 採用された回答

madhan ravi
madhan ravi 2019 年 3 月 6 日

0 投票

Anew = A;
Anew(B) = 1

1 件のコメント

sarina hosseini
sarina hosseini 2019 年 3 月 6 日
thank you it worked

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by