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 ExchangeFile 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