Save a plot in Matlab as a matrix [duplicate]

2020-02-07 05:37发布

Just imagine you plot several dots, circles, lines in a figure. Afterwards another m file should use this plot as an input to do e.g. thresholding. I'm aware of the print command but I don't want the plot to be stored as file. I would prefer to store it in a matrix (x_dim,y_dim,3). Any ideas?

2条回答
家丑人穷心不美
2楼-- · 2020-02-07 05:47

You should check out the functions getframe and frame2im to convert a figure or axes object to an image matrix.

查看更多
萌系小妹纸
3楼-- · 2020-02-07 06:07

How about save to an image? You can use getframe to get a frame object F, where F.cdata contains the RGB values. Remember to use 'border', 'tight' option to avoid capturing the borders.

查看更多
登录 后发表回答