Calling data with using rand command

1 回表示 (過去 30 日間)
FURKAN CEVAHIR
FURKAN CEVAHIR 2019 年 2 月 5 日
コメント済み: KSSV 2019 年 2 月 5 日
Hi, I want to call data in the matrix by using string which is defined by rand command.
A=[1 2]
B=[2 3]
C=[3 5]
corners = 'ABC'
randompick = corners(randi(numel(corners)))
disp(randompick)
randompick(1)
Here I cant get any first row numbers of the A, B, and C.
What's wrong in this script?
Thanks.
Desired answer is
Same as what A(1), B(1) or C(1) give after randomly chosing.
  2 件のコメント
madhan ravi
madhan ravi 2019 年 2 月 5 日
what‘s the desired output?
FURKAN CEVAHIR
FURKAN CEVAHIR 2019 年 2 月 5 日
Same as what A(1), B(1) or C(1) give after randomly chosing.

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

採用された回答

KSSV
KSSV 2019 年 2 月 5 日
A=[1 2
2 3
3 5] ;
corners = 1:size(A,1) ;
randompick = corners(randi(numel(corners)))
disp(randompick)
idx = randompick(1) ;
iwant = A(idx,1)
  6 件のコメント
FURKAN CEVAHIR
FURKAN CEVAHIR 2019 年 2 月 5 日
My apologize, thanks..
KSSV
KSSV 2019 年 2 月 5 日
No issues.....No aplogizes.......you are welcome.......

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumeric Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by