필터 지우기
필터 지우기

Error saving matlab figure

조회 수: 90 (최근 30일)
Natalia Matuk
Natalia Matuk 2022년 3월 21일
댓글: Zhaoru Liu 2024년 2월 28일
Hi, I am trying to save an imagesc figure and I am receiving this error. I have the 2022a MATLAB version. If anyone has any comment on how I could go about saving the figure that would be great. Thanks !
Warning: Variable 'hgS_070000' was not saved. For variables larger than 2GB use MAT-file version 7.3 or later.
> In matlab.graphics.internal.figfile.FigFile/write (line 32)
In savefig (line 83)
In saveasfig (line 6)
In saveas (line 153)
In filemenufcn>localSaveExportHelper (line 218)
In filemenufcn>localSaveExport (line 346)
In filemenufcn (line 58)
  댓글 수: 3
Natalia Matuk
Natalia Matuk 2022년 3월 21일
Yes I did

댓글을 달려면 로그인하십시오.

답변 (1개)

Aman Banthia
Aman Banthia 2023년 9월 28일
Hi Natalia,
The error you're encountering typically occurs when trying to save a figure that exceeds the 2GB size limit of the standard “.fig” format.
One possible solution is to reduce the size of your figure. If your figure contains a large amount of data (e.g., a high-resolution image or a plot with many data points), try reducing the amount of data. For example, you could downsample the image or plot a subset of the data.
Alternatively, you could save the figure in a different format, such as “.png or “.jpg ”, which may not have the same size limitations. This can be done using the ‘saveas’ function:
saveas(gcf,'filename.png')
Another solution, which is particularly useful if your figure is large due to extensive data, is to change the default MAT-file version to 7.3 in your MATLAB preferences. This version uses the HDF5-based format, which can handle larger files (more than 2GB).
To do this, go to Preferences -> General -> MAT-Files in your MATLAB environment and select "MATLAB Version 7.3 or later". Then use the ‘savefig’(function to save your figure.
savefig(gcf, 'filename.fig')
Please note that this change will allow ‘savefig’ to save the figure data in the -v7.3 format instead of the -v7 format. However, the -v7.3 MAT-files are not compatible with MATLAB versions prior to 7.7 (R2008b). If you need to open the saved figure in an earlier version of MATLAB, this solution will not work.
You can refer to the following MATLAB Answers link to view a similar question:
Hope that the above solution works.
Best Regards,
Aman Banthia
  댓글 수: 1
Zhaoru Liu
Zhaoru Liu 2024년 2월 28일
Succesfully saved the .fig file by changing default MAT-file version to 7.3. Thanks a lot!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by