Error Opening File with readtable
이전 댓글 표시
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!
답변 (1개)
Walter Roberson
2019년 7월 11일
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')
카테고리
도움말 센터 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!