Error: Unrecognized Variable Name

3 次查看(过去 30 天)
I'm trying to use strings read from an .xls as dataset variable names.
If I use them as imported and run the following code it works, although I get the information that they were modified by matlab to make them valid.
Dataset = set(Dataset,'VarNames',Names)
However, I need to manipulate them a bit. I.e. I need them to be in lower-case and without spaces. I therefore tried
Names = lower(Names);
Names = regexprep(Names, '[. ]','');
But when I run the code above after these manipulations (or only applying lower case) I get the following error:
??? Error using ==> dataset.subsref at 257
Unrecognized variable name 'Date'.
where 'Date' is the first string in Name. When checking by using
whos Name
in either case all the informations are the same except when removing the spaces memory size becomes obviously a little smaller.
So my question is what I did wrong that assigning the modified names doesn't work when it works with the unmodified ones?
Your help is very much appreciated!
  1 个评论
the cyclist
the cyclist 2012-1-9
It would be easier to help you debug this if you supplied the briefest possible example of "Names" that gives the error, so that we could run your code and get the error more simply. Otherwise, we have a fair amount of guesswork to do.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by