MATLAB Answers

variable name length exceeds 63 characters

182 views (last 30 days)
Diana Acreala
Diana Acreala on 25 Jul 2011
Commented: Walter Roberson on 30 Nov 2020
Hello, I'm new here:) maybe you can help me with a problem. I need to use some variables whose names are exceeding 63 characters. Does anyone have any idea? I must fix this problem quickly:D
Thanks in advance!
  1 Comment
Nathan Greco
Nathan Greco on 25 Jul 2011
As always, examples help. What do your variable names look like?

Sign in to comment.

Accepted Answer

Jan on 25 Jul 2011
Your demand for more than 63 characters sounds, like you store important values in the name instead of the contents of a variable. A program using such long symbols is nearly unreadable and debugging will be ridiculous hard.
Beside the fact, that the limit of 63 characters is hard coded and cannot be changed in MATLAB, I assume that there is a misconcept in your program design. Please explain, why you want to stuff so much information in the names.

Sign in to comment.

More Answers (6)

Oleg Komarov
Oleg Komarov on 25 Jul 2011
Cannot help, but why do you need such long names?
Names are meant to identify quickly a variable, if you're trying to include meta data in the name I would rather suggest to create a structure with meta fields and data field.
s.description = 'longdescription' = 'myPlace' = 10;
To search for files keep a cell array with short names (the ones you actually save the file as) and the long ones:
names = {'ak47_19992102', 'long description'
'ak47_19992102', 'another long description'};
search on the second column and match with teh real names.
Or using the struct array you can search through all the s.description
Also, are you using/planning to use eval?

AL REY on 14 Jan 2020
Hello, I might reopen this topic. But i would like to add a reason why we do have so long name. On my side i'm using '.mf4' data from CANAPE (Vector), the recorded label are often the software structure and exceed the 63 limit, it's also something that we can change unless we change the software dictionary. Some native matlab function (blockset) as mdf('name.mf4') and read can't deal with such naming.
It will be nice to have a way to avoid that limit.
  1 Comment
Walter Roberson
Walter Roberson on 15 Jan 2020
Make the recorded label data rather than a variable name at the MATLAB level.

Sign in to comment.

Diana Acreala
Diana Acreala on 25 Jul 2011
Variable name must be explicit, among others should include the name of a graph axis and exceeds 63 characters (to do a search when needed).. it's a must to do this and I can't find any solution..
Thanks for you answer :)

Walter Roberson
Walter Roberson on 25 Jul 2011
This is not possible in MATLAB.
Perhaps it would make more sense to break your variable up in to a structure. For example, instead of
you could use
which would be a structure array.

Walter Roberson
Walter Roberson on 25 Jul 2011
Possibly the Map Container would be suitable for your work, allowing you to index variables according to arbitrary strings. See here

Diana Acreala
Diana Acreala on 26 Jul 2011
OK! Thank you all for your answers!
I will change my idea of solving the problem, I decided to reorganize the GUI and it is not necessary to create a structure. However, is a good idea for the future. Now I have many variables and the client does not know yet how he wants the variables to be organized.
Now I'm stuck on something else, but I will write a message with a new topic:D
Walter Roberson
Walter Roberson on 17 Jul 2017
... and posting as a new Question would be a good idea.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!