Error Opening File with readtable
Show older comments
I am trying to open couple of files in different directories all that have the same name, because it is a long list (I only attached a short list here) I put it in a for loop. I know that the file does exist and that the path is correct from where I run.
for name = {'747','585','9555'}
filename = '/sort_pos.txt';
filename = strcat(name,filename);
A = table2array(readtable(filename,'Format','%f\t%f\t%f'));
end
The error I get is:
"Error using readtable (line 143)
Input must be a row vector of characters."
Any help would be amazing, thanks!
Answers (1)
Walter Roberson
on 11 Jul 2019
Inside your loop name is a cell array of character vector and strcat involving it is going to return a cell array of character vector which readtable cannot process.
fullfile(name{1}, 'sort_pos.txt')
Categories
Find more on Environment and Settings 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!