readtable error after r2014a --> r2022b upgrade
Show older comments
I have a script coded in MATLAB R2014a, running correctly. After intalling R2022b or later this line
t = readtable('test.txt', 'Delimiter',';');
results in error:
Delimiter must be a string array, character vector, or cell array of character vectors.
Why?
(t=readtable('test.txt') also causes this error.)
1 Comment
Walter Roberson
on 7 Jan 2025
It seems likely to me that you have some third-party function with the same name as a Mathworks function, and that third-party function is interfering with parsing the delimiter.
Unfortunately after a bunch of tracing, I do not see where in the internal code that the validity of the delimiter is tested, so I am not presently able to guess as to which third-party function might be involved.
I suggest to copy the data file into a new directory, and try the readtable() from that new directory; if it works then the problem is a third-party function in you previous current directory. If it does not work, then I would suggest experimenting with
restoredefaultpath; rehash toolboxcache
and seeing whether the readtable() works; if it does then the problem is with some third-party toolbox that you had on your path.
Answers (1)
Star Strider
on 7 Jan 2025
0 votes
Try one of these —
t = readtable('test.txt', 'Delimiter',";");
or:
t = readtable('test.txt', 'Delimiter',{';'});
The only illustrations in the 2024b documentation use string, " " arrays, although creatiing a cell array (by enclosing the value in curly brackets {}) could also work.
2 Comments
Dora
on 7 Jan 2025
It runs here without error —
T1 = array2table(randi(9,5,3))
writetable(T1, 'test.txt', 'Delimiter',';')
type('test.txt')
t = readtable('test.txt', 'Delimiter',';');
disp(t)
I seriously doubt that this is an inherent problem with R2022b itself, although your installation may be having problems.
.
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!