Limitations for table variable name
28 ビュー (過去 30 日間)
古いコメントを表示
Hello, dear community!
I try to name table variable with non-Latin character, for example Cyrillic:
>> a = table(zq, 'VariableNames', cellstr('я'));
Error using matlab.internal.tableUtils.makeValidName (line 36)
'я' is not a valid variable name.
Error in setVarNames (line 48)
[newnames,wasMadeValid] = matlab.internal.tableUtils.makeValidName(newnames,exceptionMode); % will warn if mods are made
Error in table (line 305)
t = setVarNames(t,vnames); % error if invalid, duplicate, or empty
If I do the same, but with variable named using Latin characters, then everything works fine. What could cause this error? Is this normal behavior?
Thank you.
0 件のコメント
採用された回答
Walter Roberson
2015 年 10 月 22 日
Normal. The names have the same restrictions as matlab variable names. Latin letter to start, continue with digits or underscore or Latin letters
6 件のコメント
Walter Roberson
2015 年 10 月 28 日
If using xlswrite is acceptable, then use num2cell() to convert the numeric matrix to a cell array, add the headers to the top of that, and xlswrite() the whole thing out.
その他の回答 (1 件)
Vy Le
2021 年 2 月 9 日
Hi, why I write it and they said 'inifity norm of number c' is not a valid table variable name
Thank you.
names = {'inifity norm of condition number c','infinity norm of the residual r1'};
table(c,r1,'VariableNames',names)
1 件のコメント
Steven Lord
2021 年 2 月 9 日
Prior to release R2019b table variable names were required to be valid MATLAB identifiers. In particular, that meant no spaces. That limitation was removed in release R2019b.
v = (1:5).';
A = table(v, v.^2, v.^3, 'VariableNames', ["v", "v squared", "v^3"])
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!