Save an invisible figure in an image matrix without priniting the matrix on the screen
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I've been working on this for days and I haven't found any satisfying solution yet. I am working on a script generating a lot of images in a for loop. I have to use tow figures because I need two different colormap. If there's a way of plotting the surf with the two different colormap in the same figure, it'll be much easier but I read that it's impossible.
After initialising two figures in invisible mode ('visible'='off') with explicit set of the resolution and compute all the variables I need, here is what I want to do inside the loop :
- plot some stuffs in both figures
- save an image of the first figure in matrix IMG1 with the same resolution as in the initialisation and save an image of the second figure in matrix IMG2 with the same resolution
- take a portion of the first matrix and a portion of the second matrix to make a new image matrix
- save the the final image with imwrite()
The only solution I found to do the 2. is to save each image in a file with print() and then store it with imread(). But it's awfully long. I need to generate approximately 800.000 images and for the moment, the script is approximately 8 days long 24/24.
Does anybody have a solution to do the 2. without writing the files on the disc? I tried with getframe but getframe make the figures appear and so make the script much much slower.
Thank you
ToM
0 个评论
回答(2 个)
Oleg Komarov
2011-8-4
Is this what you're trying to do, superimpose two surf with two different colormaps?
h.f = figure;
h.a(1) = axes('Parent',h.f);
[x,y,z] = peaks(30);
surfc(h.a(1),x,y,z)
colormap hsv
axis([-3 3 -3 3 -10 5])
h.a(2) = axes('Parent',h.f);
k = 5;
n = 2^k-1;
[x,y,z] = sphere(n);
c = hadamard(2^k);
surf(h.a(2),x,y,z,c);
set(h.a(2),'Color','none','Xlim',[-3 3],'Ylim',[-3 3],'Zlim',[-10 5])
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!