i want to get a key(integers/character/string) from the user and generate a random matrix using that key and particular to that key only. meaning if i again use that key for generating a matrix i would get similar matrix.matrix should be having unit8 values less than 256.

2 件のコメント

Jan
Jan 2013 年 8 月 12 日
How large is the key and the matrix?
vardhit
vardhit 2013 年 8 月 12 日
matrix can be as large as an image matrix can be.. i really dont have any idea about key..but if u ask me about the sample space of key.i want it to be from integer 1-100.or even a string.

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

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 11 日
編集済み: Azzi Abdelmalek 2013 年 8 月 11 日

0 投票

key=3 % for example
rng(key)
out=uint8(randi([0 255],2,4) % matrix 2x4

7 件のコメント

vardhit
vardhit 2013 年 8 月 11 日
what is rng? its undefined in matlab.
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 11 日
vardhit
vardhit 2013 年 8 月 11 日
??? Undefined function or method 'rng' for input arguments of type 'double'. it gives an error
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 11 日
In Matlab windows command, type
which rng
What did you get?
vardhit
vardhit 2013 年 8 月 11 日
'rng' not found.
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 11 日
I don't know if it's due to the version of your Matlab, or there is another problem. Maybe you should contact Mathworks technical support
Walter Roberson
Walter Roberson 2013 年 8 月 12 日
編集済み: Walter Roberson 2013 年 8 月 12 日
rng is only defined in later versions of MATLAB. see http://www.mathworks.com/help/matlab/ref/randstream.html

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Random Number Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by