I am trying to write a function that will update a plot "on the fly". For instance, in the test function:(adsbygoogle = window.adsbygoogle || []).push({});

function colorplot

x = ones(100,100);

for i = 1:100

for j = 1:100

x(i,j)=uint8(255^((i+j)/200));

image(x); colormap(gray)

end

end

MATLAB will run the entire function before displaying the image in the matrix x. I want to get MATLAB to update the plot as soon as it changes a single pixel (or more generally, whenever I tell it to!). Does anyone know how to do this? The only way I have been able to close to getting this to happen is to use the "figure" command right before "image", but this just generates 100*100 images when I only want 1.

UPDATE: I found a function drawnow which performs what I want the plot to do, but it is extremely slow. drawnow redraws the whole plot but I am only updating a few pixels. Any ideas?

**Physics Forums - The Fusion of Science and Community**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Plotting in matlab

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads for Plotting matlab | Date |
---|---|

MATLAB Plotting Coordinate Transformations in Matlab | Feb 12, 2018 |

MATLAB Plotting animations (time-evolution) | Jan 17, 2018 |

MATLAB Does anyone had this plotting problem with MATLAB? | Dec 23, 2017 |

MATLAB Matlab's plot command | Nov 30, 2017 |

MATLAB Matlab -- how to make a smooth contour plot? | Jun 28, 2017 |

**Physics Forums - The Fusion of Science and Community**