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

Antworten (1)

Stephen23
Stephen23 am 10 Feb. 2023
Bearbeitet: Stephen23 am 10 Feb. 2023

0 Stimmen

"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

Kategorien

Produkte

Version

R2022b

Gefragt:

am 10 Feb. 2023

Bearbeitet:

am 10 Feb. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by