Azzera filtri
Azzera filtri

vv with long names

2 visualizzazioni (ultimi 30 giorni)
jose herrero
jose herrero il 9 Ott 2017
Commentato: Steven Lord il 9 Ott 2017
Hey, got installed the 2016b version on mac and it seems to not like programmes with long names: when i try to run this code directly step1_preproccessing_CL_TDT-170920-112847
gives me this error: Undefined function or variable 'step1_preproccessing_CL_TDT'.
if I change the name to shorter one (e.g.,step1_CCEPs_Pre) it runs ok but it's no good for me as i wanna call my code as above.

Risposta accettata

Guillaume
Guillaume il 9 Ott 2017
Matlab only uses the first namelengthmax characters of any identifiers. This has been fixed to 64 characters since forever and there's been no indication that it's about to change.
There is no workaround, you will have to use shorter names. Embedding metadata in filenames is not a good idea anyway. Embed that metadata with your data instead.
  1 Commento
Steven Lord
Steven Lord il 9 Ott 2017
namelengthmax is currently 63 characters and has been at 63 characters. The limit on the maximum identifier length was increased from 31 to 63 at the same time the namelengthmax function was introduced, both in MATLAB 6.5 (release R13.) See the Release Notes for that release for more information. Note that viewing this old documentation may require logging in to your MathWorks account.

Accedi per commentare.

Più risposte (1)

Steven Lord
Steven Lord il 9 Ott 2017
In this case the problem is not with the length of the name but with the characters it contains. The names of functions in MATLAB must start with a letter, must be no longer than namelengthmax characters, must not be the same as a keyword (with the exception of an overloaded end method), and must contain only letters, numbers, and the underscore character.
The name step1_preproccessing_CL_TDT-170920-112847 satisfies three of those four requirements. It fails the last; the character '-' is not allowed in function or variable names.

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by