I understand, you are trying to export an animated plot to html. It is exporting the script to HTML but the figure is still static. There is no direct option for doing this, but there is way to make this happen.
Steps:
- You can save the plot animation to a video file, while it is plotting frame by frame.( Refer this for the same: https://in.mathworks.com/matlabcentral/answers/455886-how-to-save-animated-plots#answer_370280 )
- Now export your script to HTML. Open it in any file editor and delete the image tag of the plot.
- Now add the below code in the HTML file to add video element.
<video width="320" height="240" controls>
<source src="fileName.mp4" type="video/mp4">
</video>
Now open the HTML file in your browser. You can find that the plot animation video is playing.
Alternatively, you can convert this video to gif and add that to your HTML file as well.