I'm working on a project where I need to navigate to some user-specific folders and there iterate on each file, but If I try to like this:
clear all;
clc;
close all;
folder_read = dir('testfolder\*.csv');
cd testfolder\
numel(folder_read)
for i = 1:numel(folder_read)
i
end
then I got Error using cd Cannot CD to C:\Users\Username\Desktop\folder\theoldroute\testfolder (Name is nonexistent or not a directory).
And if I try to like this:
clear all;
clc;
close all;
% Read the data folder
folder_read = dir('route\to\folder\*.csv');
% Read the data
oldfolder = pwd;
cd
numel(folder_read)
for i = 1:numel(folder_read)
i
end
Then I got ans = 0 Which is'nt true, in that folder is 5 .csv.
So my question is how can I get them? Which is the right way? I didn't find a solution on the Matlab forum neither. This is maybe something basic, but I don't know too much about Matlab.