필터 지우기
필터 지우기

Error saving figure: "fileparts (line 43). input must be a row vector of characters"

조회 수: 18 (최근 30일)
Hello, I recently can't save figures as .fig files. it worked until a few weeks ago but suddenly I'm getting an error. I can save the same figure as .png or .jpg, but specifically .fig is not working anymore. The error: "input must be a row vector of characters". I changed the file name to only letters but it still didn't work. this is my code:
> f=figure;
> plot(courtship_index),
> cd('/Users/dgal/MATLAB_results/160901_courtship/')
> saveas(f, 'courtship_index', 'fig')
and I received this error chain:
Error using fileparts (line 43)
Input must be a row vector of characters.
Error in savefig (line 53)
[fpath,fname1,ext] = fileparts(fname);
Error in saveasfig (line 6)
savefig(h, name);
Error in saveas (line 140)
feval( ['saveas' format], h, name )
Error in trim_function (line 67)
saveas(f, 'courtship_index', 'fig')
in a separate case I plotted a different figure and tried to save it by clicking "file" -> "save as" on the figure itself, but got the same error: "error using fileparts (line 43). input must be a row vector of characters".
  댓글 수: 4
dpb
dpb 2016년 9월 7일
What happens if you simply try fileparts from the command line--
fileparts('courtship_index') % ?
Also what does
which fileparts
return and there's always
clear fileparts
then see what happens...
Dana Galili
Dana Galili 2016년 9월 7일
dpb: that did not help. here is my code:
fileparts('courtship_index')
ans =
''
> which fileparts
/Users/dgalili/Documents/MATLAB/JAABA_Release_v0.6.0/filehandling/fileparts.m
> clear fileparts
> savefig(f, 'courtship_index', 'fig')
Error using fileparts (line 43) Input must be a row vector of characters.
Error in savefig (line 53) [fpath,fname1,ext] = fileparts(fname);

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

채택된 답변

Steven Lord
Steven Lord 2016년 9월 7일
Which release of MATLAB are you using?
Are you certain you're using the fileparts function included in MATLAB? Does this show any fileparts.m file outside the toolbox/matlab subdirectory in your MATLAB root directory?
which -all fileparts
  댓글 수: 9
Dana Galili
Dana Galili 2016년 9월 13일
The bug was caused because JAABA's savefig clashed with Matlab's savefig. the developer renamed JAABA's savefig and saveas now works fine. thanks for all the help.
Steven Lord
Steven Lord 2016년 9월 13일
Ah, so the root cause of the problem was one level up. Thanks for closing the loop and letting us know what happened.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by