How can i form a filename from MATLAB identifier and correcting sntax error in "3dinvert.m"

5 次查看(过去 30 天)
In attempt to run a code i got this error responses
1)
335- fclose(fid);
Line 335:Filename 'C:\Matlab\3dinvert.m' if not formed from a valid MATLAB identifier
2)
Syntax error:"3dinvert.m cannot run as it appears
3dinvert
Enter input arguments by typing it now,then press Enter to run. The values you enter will be set as deffaul input when you click the Run button in future.
Please, what is your advice
Thank you
Femi

回答(1 个)

Bjorn Gustavsson
Bjorn Gustavsson 2022-1-14
There are restrictions of the filenames for matlab-functions, and as far as I recall it is supposed to not start with a number (I couldn't quickly find the documentation for this, but you should be able to search for this. In my work I also stay away from leading "_", so start with [A-Za-z]). So try to put the number somewhere but in the leading place. Also make good use of the fullfile, filesep and fileparts functions - they will make your functions and scripts more portable across different OSes (this might seem like a remote consideration from your perspective - but if you're lucky and your programmes becomes useful enough this is a major gain when you get users on all sorts of environments...).
HTH
  3 个评论

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品


版本

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by