create a script that makes a x y graph. every time that the script runs adds a new (x,y) point to that graph in matlab

Here is an example of how to create a script that creates an x-y scatter plot in MatLab and adds a new point to it every time it is run:

main.m
% First, create a blank figure and axis
figure;
ax = gca;
ax.XLim = [0 10]; % Set the limits of the x-axis
ax.YLim = [0 10]; % Set the limits of the y-axis
xlabel('X');
ylabel('Y');

% Then, generate a new random point and add it to the plot
x = rand*10;
y = rand*10;
hold on; % This tells Matlab to keep the existing plot and add to it
scatter(x,y,'filled');
360 chars
14 lines

You can save this script as a function and run it repeatedly to add new points to the graph. Calling the function hold on before adding new data to the plot will ensure that previous data is not lost.

gistlibby LogSnag