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개)
Sulaymon Eshkabilov
2023년 2월 5일
In terms of time efficiency, exportgraphics() is faster than saveas().
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!