フィルターのクリア

How can I produce a matrix with below condition?

1 回表示 (過去 30 日間)
S AsZ
S AsZ 2023 年 11 月 10 日
コメント済み: Voss 2023 年 11 月 10 日
Hi everyone.I need to produce a k×1 matrix that its first element always is 1 and the others return a random number in [0,1].This interval contains 0 and 1 and all values between them.

採用された回答

Voss
Voss 2023 年 11 月 10 日
Something like this may be good enough:
k = 8;
result = [1; rand(k-1,1)]
result = 8×1
1.0000 0.2558 0.8030 0.3604 0.5523 0.6364 0.1631 0.6867
  2 件のコメント
S AsZ
S AsZ 2023 年 11 月 10 日
Thanks 🌹
Voss
Voss 2023 年 11 月 10 日
You're welcome!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by