Hi Shromaneko,
迅速に対応できるよう、この返信は英語で行われます。
I understand that you want to plot the values of episode number and data one step before the episode finishes. Currently, you can plot the first one without overlapping the second and subsequent plots. You can modify your current code by creating a new figure for the first episode and then using the hold on to plot the subsequent plots.
function y = fcn(t, maxSteps, data, x)
t = round(t);
j = t == maxSteps - 1;
if j
if x == 1
figure; % Create a new figure for the first episode
end
plot(x, data, 'kx');
xlim([0 x+1]);
ylim([0 2]);
hold on; % Enable hold on for subsequent plots
x = x + 1;
end
y = x;
end
By using the above code, you will be able to visualize the overlaid plots.
To learn more about 'figure', please refer to the following documentation Create figure window - MATLAB figure - MathWorks India.