For a very large matrix of (1500000, 6) I wish to change the first 10 values in column 1 to 1, the next 10 values to 2, the next 10 to 3, etc.
Using for example:
X = randi([0,1],[1500000,6]);
To create the table.

 採用された回答

Tommy
Tommy 2020 年 4 月 5 日

0 投票

Try this:
N = 1500000;
X = randi([0,1],[N,6]);
i = 1:N/10;
X(:,1) = repelem(i,10);

1 件のコメント

RickJ
RickJ 2020 年 4 月 5 日
That's it! Incredible, thank you so much!!!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

製品

質問済み:

2020 年 4 月 5 日

コメント済み:

2020 年 4 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by