i want to make random size of my datasample.output must give random size array. As i am very new in matlab. please help.

4 ビュー (過去 30 日間)
r=datasample('ATCG',20);
r =
TCACCAAAATCACAGGTATG

採用された回答

Guillaume
Guillaume 2015 年 3 月 2 日
編集済み: Guillaume 2015 年 3 月 2 日
More explanation in the question would be helpful. Possibly, this is what you want:
pickfrom = 'ATCG';
howmany = 20;
pickvalues = pickfrom(randi(numel(pickfrom), 1, howmany))
That is use randi to select a random set of indices that give you which value to pick from your data set.
  6 件のコメント
Tonmoy saha
Tonmoy saha 2015 年 3 月 2 日
thank you sir. you help me a lot. Actually i am doing a project using matlab. If you don't mind can i contact you further.
Guillaume
Guillaume 2015 年 3 月 2 日
You'll get a lot more help by just posting questions on this forum. There's a lot of people here who are willing to help.

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

その他の回答 (1 件)

Jos (10584)
Jos (10584) 2015 年 3 月 2 日
you want a random size sample? Like this, perhaps:
DATA = 'ATCG'
K = randi([10 20],1) % random number between 10 and 20
Y = datasample(DATA,K)
  1 件のコメント
Tonmoy saha
Tonmoy saha 2015 年 3 月 2 日
編集済み: Tonmoy saha 2015 年 3 月 2 日
actually i want random size samples from that datasample. suppose if the datasample is TCACCAAAATCACAGGTATG. than i want samples like CACCAA, TCACAGG,.. like that. these sample must be randomly pick and also may have different size.

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

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by