How can i generate random numbers from an array?

I want to generate random numbers from the array actionset=[]; but those numbers are also negative and decimal numbers. Below is my code so if anyone could help i would appreciate it.More specific I want to correct the row in the program before the last.
current_state=randi([1,12]);
## while current_state~=goal_state
actionset=[];
for action=1:2
if reward(current_state,action)~=-inf
actionset(end+1)=action;
endif
endfor
action=actionset(randn(numel(actionset)));
next_state=nextstate1(action);

1 件のコメント

KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 10 月 9 日
編集済み: KALYAN ACHARJYA 2018 年 10 月 9 日
The answer is here, Check it.
Also here

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

質問済み:

2018 年 10 月 9 日

編集済み:

2018 年 10 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by