How can i form a filename from MATLAB identifier and correcting sntax error in "3dinvert.m"
6 views (last 30 days)
In attempt to run a code i got this error responses
Line 335:Filename 'C:\Matlab\3dinvert.m' if not formed from a valid MATLAB identifier
Syntax error:"3dinvert.m cannot run as it appears
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
Bjorn Gustavsson on 14 Jan 2022
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...).