Table Variable Name "X_|P|" works on my computer.....does not work on anyone elses

2 Ansichten (letzte 30 Tage)
Hey MatLab world,
I wrote a script that produces a table with a set of variable names. The variable name uses the bar/pipe character ' | ' (i.e. shift+backslash).
On my computer it all works fine and creates the table with these variable names. On anyone elses comptuer it throws an error saying, "X_|P| is not a valid table variable name."
Yes, I've read the matlab section on variable names, https://www.mathworks.com/help/matlab/matlab_prog/variable-names.html and I know that it only mentions letters, digits and underscores. But on my computer it makes the table every time with all my variable names and absolutely zero errors. Any help or insight would be greatly appreciated. No toolboxes or packages being used. Matlab version is 2019b update 1. Code pasted below for reference.
% BEGIN CODE %
clear all; close all; clc;
% Create Table Variable Names
XCoeffs = {'X_star1', 'X_P', 'X_|P|', 'X_PP', 'X_P|P|', 'X_star2', 'X_Q', 'X_|Q|', 'X_QQ', 'X_Q|Q|', 'X_|Q|P', 'X_Q|P|', 'X_|QP|', 'X_QP'};
% Create table 'X' within structure 'Experiment.Data'
Experiment.Data.X = table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'VariableNames', XCoeffs);
% END CODE %
p.s. I do a check by typing "Experiment.Data.X.Properties.VariableNames" into the command prompt and it returns the same exact variable names defined above.
THANKS!!!!

Akzeptierte Antwort

Star Strider
Star Strider am 6 Jul. 2020
The extended variable names began in R2019b.
From the Release Notes for R2019b with respect to table variable names:
‘Starting in R2019b, the names of variables in tables and timetables can have any Unicode® characters, including spaces and non-ASCII characters. Previously, table and timetable variable names had to be valid MATLAB identifiers. For more information, see table, timetable, or Access Data in Tables.’
See this Release Notes Excerpt for a full discussion.

Weitere Antworten (2)

Hussein Ammar
Hussein Ammar am 6 Jul. 2020
Bearbeitet: Hussein Ammar am 6 Jul. 2020
This may be related to the version of the Matlab. You may find your answer here.
https://www.mathworks.com/matlabcentral/answers/477755-table-variable-names

kevin hale
kevin hale am 7 Jul. 2020
Makes perfect sense. Thanks so much guys!

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by