Unrecognized method, property, or field 'randi' for class 'rl.util.rlFiniteSetSpec'.
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I am trying to sample an action from the actionspace which is in the predefined MATLAB environment 'BasicGridWorld'.
env = rlPredefinedEnv('BasicGridWorld');
obsInfo = getObservationInfo(env);
actInfo = getActionInfo(env);
disp(obsInfo)
disp(actInfo)
a= actInfo.randi()
However the actInfo belongs to the class rl.util.rlFiniteSetSpec which does not support rand or randi method and is of type string.
I suppose I have to first convert it to type num and then randomly select 1 out of the 4 actions from that class?
Is this approach correct?
댓글 수: 0
답변 (1개)
Geoff Hayes
2022년 4월 1일
@Ankita Tondwalkar - from here, actInfo is an array of rlNumericSpec objects | array of rlFiniteSetSpec objects. I think that you need to first determine the length of the array and then choose an integer between one and that length using randi.
참고 항목
카테고리
Help Center 및 File Exchange에서 Sample Class Implementations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!