Files are not loading into my program

Hi,
i've got a problem with loading files into my matlab program, i dont really know what am i doing wrong and why i have error like that, can you tell me what should i change? I need to load files with informations into the program and make some graphs in that but main problem is with loading

답변 (1개)

Stephen23
Stephen23 2023년 2월 10일
편집: Stephen23 2023년 2월 10일

0 개 추천

"i dont really know what am i doing wrong..>"
You are using LS() instead of DIR().
LS() is intented for a pretty display, not for iterating over. In contrast, the output of DIR() is very easy to iterate over.
"...can you tell me what should i change?"
Use DIR() not LS(), just as the MATALB documentation shows:
For example:
P = 'absolute or relative path to where the files are saved';
S = dir(fullfile(P,'*.csv'));
for k = 1:numel(S)
F = fullfile(S(k).folder,S(k).name);
T = readtable(F);
% do whatever you want with table T
end

카테고리

도움말 센터File Exchange에서 File Operations에 대해 자세히 알아보기

제품

릴리스

R2022b

질문:

2023년 2월 10일

편집:

2023년 2월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by