Is there a 25 char limit to name lengths of imported variables?

2 views (last 30 days)
I know that the 63 char limit is imposed to variable names in MATLAB, but it seems that the import gui is cutting off my variable names at 25. I have an excel file which includes a row of variable names the the gui recognizes as such. The auto generated names it comes up with stop after 25 characters. I've looked everywhere and can't seem to find any information about this. Does anyone have any ideas? Thanks.
Note: Just to be clear, I can change the names once imported or in the gui before, but there are many of them and I want them to be imported correctly without any extra input.
  1 Comment
dpb
dpb on 31 Dec 2013
Not familiar enough w/ the gui import tool to know for certain but it would seem you have empirical evidence as to the behavior. Send a support missive to official support at mathworks.com for confirmation and any workaround they happen to know of.
I'd guess the only automated solutions would be to generate the Excel files within the limitation if you insist on using the tool.
Alternatively, if you're doing a lot of this, check out
doc importdata
doc xlsread
and/or
doc textscan

Sign in to comment.

Answers (1)

Jan
Jan on 1 Jan 2014
You can use the debugger to step through the code of importdata (is this the tool you are using? You will find this out using the debugger also...) line by line. Check, if the strings containing the names are limited to 25 characters after the import already, or later, when the variables are assigned. Perhaps there is a space, linebreak or special character at the 26.th position?
  2 Comments
David
David on 2 Jan 2014
I used the import gui so I'm not really sure what code is being used in the background. Also, there is no special character at the 26th position, just another letter in the variable name. Something like timeAtMeasurementOfDataForSomething gets turned into timeAtMeasurementOfDataFo
Jan
Jan on 5 Jan 2014
You can find out, which function is called by using the profiler:
profile on
% Start the import gui, perform some actions there
% Cancel the import
profile report
Under R2009a it is uiimport. Then you can set a breakpoint in the corresponding M-code and inspect what's going on. On one hand this migth help to answer your question, on the other hand you will learn a lot about Matlab and the efficient usage of the debugger.
But if the question cannot be cleared by this way, asking the technical support of TMW seems to be a good idea also.

Sign in to comment.

Categories

Find more on Data Import and Export in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!