code to form a matrix by selecting some elements in another matrix

i have a matrix with me which is a rectangular matrix of size 14*13. now i need to select some elements randomly from this matrix and form another matrix of size 14*13. can u give me the code for this as soon as possible.

1 件のコメント

Evan
Evan 2014 年 10 月 10 日
Note that users here will be more receptive if you show willingness to work toward a solution yourself. Posting an attempt shows this. This can be accomplished with very little code, so it should be do-able if you're willing to put in the effort.
Many users are happy to supply partial or complete solutions to your problem, but its considered poor form here to demand a cut-and-pasteable code without putting in any effort yourself.

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

 採用された回答

Evan
Evan 2014 年 10 月 10 日
編集済み: Evan 2014 年 10 月 10 日

0 投票

Look into the randi function.

その他の回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 10 月 10 日
編集済み: Azzi Abdelmalek 2014 年 10 月 10 日

1 投票

y=rand(14,13) % Example
out=y(randperm(14*13,13))'
Sanjay Lodwal
Sanjay Lodwal 2014 年 10 月 10 日
編集済み: Sanjay Lodwal 2014 年 10 月 10 日

1 投票

i think it is not possible. if you want random matrix random function is best.
>>y=rand(14,13);
or A is old matrix.
for m = 1:14
for n = 1:13
B(m,n)=A(floor(rand(1)*14*13));
end
end

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2014 年 10 月 10 日

編集済み:

2014 年 10 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by