what is the most efficient way to write multiple plots to the local drive?
4 次查看(过去 30 天)
显示 更早的评论
More than 1.5 million plots must be saved to my local drive before my deep network trained.
What is the best way to write this bunch of plots efficiently?
is there any way to write with graphics (GPU)?
here is my code.
figure('visible','off','position',[0,0,244,244]);
parfor i = 1:numel(data)
line_width = 1;
clf,hold on;axis off;
for j = 1:numLines
plot((data{i,1}(j,:)),'LineWidth',line_width);
end
imFileName = [num2str(i) '.jpeg'];
exportgraphics(gca,imFileName);
end
data is a cell with size of 1000000*1
and each cell size is 10*100
All of them need to be saved not to plotted , but it takes many days!
2 个评论
dpb
2023-2-5
"More than 1.5 million plots must be saved...."
I fail to understand why the plots would have to be saved and what possible use could be made of that many plots even if did?
What do you really need -- the x,y pairs of data inside the plots, maybe? Even if so, there has to be a much more efficient way to approach the end problem, whatever it is...
回答(2 个)
Walter Roberson
2023-2-5
Some performance tune-ups
parfor i = 1:numel(data)
persistent fig ax lines
line_width = 1;
if isempty(fig)
fig = figure('visible','off','position',[0,0,244,244]);
ax = axes(fig);
end
cla(ax);
plot(ax, data{i}.', 'LineWidth', line_width); %plot each ROW
axis(ax, 'off');
imFileName = i + ".jpeg";
exportgraphics(ax,imFileName);
end
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!