필터 지우기
필터 지우기

error using savefig: too many input arguments

조회 수: 14 (최근 30일)
JOSE LUIS GOMEZ AMO
JOSE LUIS GOMEZ AMO 2024년 7월 25일 8:50
답변: JOSE LUIS GOMEZ AMO 2024년 7월 25일 10:53
Hello,
For a while, I've been getting the error: error using savefig: too many input arguments when I try to save a figure in .fig format, using either saveas or savefig functions. It appears even when I try to save the figure manually from the figure window.
This happens to me in version R2022b and R2021a, used on different PCs and even when I run programs that previously worked well. The syntax of the functions I use should be good, because it worked before. I don't understand if it could be a problem with the version of Matlab used (I don't think so because other colleagues with the same version do not receive the same error) or with my personal configuration, perhaps I have changed something without realizing it.
With all this I cannot save figures to edit them later.
Can anyone give me an idea how to solve it?
Thank you,
Jose Luis

채택된 답변

Dheeraj
Dheeraj 2024년 7월 25일 8:58
Hi JOSE LUIS GOMEZ AMO,
I understand that you are trying to save a figure to disk, but even when trying to save it from the figure by clicking File -> Save, you receive the error message "Error using save: Too many input arguments".
The manual save process, as well as the functions "saveas" and "savefig" internally use a function called "save". This appears to be the source of the error message.
It is possible that the function "save" has been inadvertently broken or overloaded. For instance, there might be a custom function named "save" on your path.
As an initial troubleshooting step, please enter the following command into the MATLAB Command Window:
which save -all
The first line of the output should normally be something like: "built-in (<path>\MATLAB\R2022b\toolbox\matlab\general\save)".
If it is a custom function instead, either rename the custom function or remove it from the MATLAB path. Then restart MATLAB (saving and loading your workspace if necessary) and try saving a figure again.
Thank you.

추가 답변 (1개)

JOSE LUIS GOMEZ AMO
JOSE LUIS GOMEZ AMO 2024년 7월 25일 10:53
Thank you so much,
It wasn't exactly the "save" function, because it could save other formats. However it was a "savefig.m" function from an old version of Matlab (around 2011). It was in an old work directory of mine that I had added to the current work path. I do not understand why.
Since I have the working directories synchronized on both PCs, I had the same problem on both. I have removed that directory from the path, and everything works again.
Thank you very much
José Luis

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by