"experienc​es=allExpe​riences (saved.age​nt.Experie​nceBuffer)​"

21 vues (au cours des 30 derniers jours)
铖
le 24 Nov 2025 à 15:20
Réponse apportée : Anumeha le 15 Déc 2025 à 10:08
Excuse me, when I am using the code "experiences=allExperiences (saved.agent.ExperienceBuffer)", I expect to get all experiences, but the system output is "experiences=empty 1x0 struct array without fields". May I ask why this situation has occurred.

Réponse acceptée

Anumeha
Anumeha le 15 Déc 2025 à 10:08
Hi ,
I understand “allExperiences” is giving empty output, which would mean that the input it receives is empty somehow. Since the code and data isn’t provided, I was able to achieve a possible workflow using this documentation page.
The code I used is given below:
obsContinuous = rlNumericSpec([2 1],...
LowerLimit=0,...
UpperLimit=[1;5]);
obsDiscrete = rlFiniteSetSpec([1 2 3]);
obsInfo = [obsContinuous obsDiscrete];
actInfo = rlNumericSpec([2 1],...
LowerLimit=0,...
UpperLimit=[5;10]);
for i = 1:10
experience(i).Observation = ...
{obsInfo(1).UpperLimit.*rand(2,1) randi(3)};
experience(i).Action = {actInfo.UpperLimit.*rand(2,1)};
experience(i).NextObservation = ...
{obsInfo(1).UpperLimit.*rand(2,1) randi(3)};
experience(i).Reward = 10*rand(1);
experience(i).IsDone = 0;
end
save('filename.mat', 'experience');
Now this is saved. So I cleared the experience variable, and reloaded it from the saved file.
load("filename.mat")
buffer = rlReplayMemory(obsInfo,actInfo,5000);
append(buffer,experience);
experiences = allExperiences(buffer)
This gives me the 10 experiences I saved.
Hope this helps.

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by