error using savefig: too many input arguments
4 views (last 30 days)
Show older comments
JOSE LUIS GOMEZ AMO
on 25 Jul 2024
Answered: JOSE LUIS GOMEZ AMO
on 25 Jul 2024
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
0 Comments
Accepted Answer
Dheeraj
on 25 Jul 2024
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.
0 Comments
More Answers (1)
See Also
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!