Saving plot with variables larger than 2 GB
이전 댓글 표시
I'm trying to save a huge boxplot figure but it is working. I used matfile and it is not saving yet. Any idea?
for i = 1:length(s)
subplot(4,5,i);
filename = (['MC Case (' num2str(i) ') .mat']);
m = matfile(filename);
Demand = m.Demand;
Supply_M = m.Supply_M;
Case = m.Case;
demand = Demand / 365;
supply_M = Supply_M / 365;
BoxPlotFunction(demand,supply_M,Case)
end
savefig('BoxPlot');
댓글 수: 3
Jan
2019년 2월 26일
"But it is working"? What exactly is the problem? What do you observe?
Munish Raj
2019년 3월 1일
I'm assuming the question is "but it is not working"
Walter Roberson
2019년 3월 1일
편집: Walter Roberson
2019년 3월 1일
Your matfile is only used for reading in data, not for saving data. The saving is being done only by the savefig()
Using the compact option for savefig can help with speed.
채택된 답변
추가 답변 (1개)
Munish Raj
2019년 3월 1일
Hello Yaser,
The mat file has to be loaded onto the workspace to perform operations on it.
This can be done by using the load command.
load filename
After this is done, you can access those variables the same way you would access any other variable in the workspace.
Your Code will then transalate to
for i = 1:length(s)
subplot(4,5,i);
filename = (['MC Case (' num2str(i) ') .mat']);
load filename
demand = Demand / 365;
supply_M = Supply_M / 365;
BoxPlotFunction(demand,supply_M,Case)
end
savefig('BoxPlot');
댓글 수: 2
Walter Roberson
2019년 3월 1일
I doubt this is the issue.
savefig() uses save() internally. If your preferences are set to use -v7 then MATLAB will try to use -v7 when it does the save(), which will fail if any object to be saved is more than 2 gigabytes. If your preferences are set to use -v7.3 then MATLAB will use that for the save() .
Yaser Khojah
2019년 3월 1일
카테고리
도움말 센터 및 File Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!