File not found pass to next path
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
For example :
path1 =char('C:\Users\Windows\Desktop\data base\H\');
path_user1 =char('user1_');
path_exp_1 =char('_h.fid');
path_procpar =char('\procpar');
path_amostra_user1=char('PA06F9ppt','PA06F13tr12','PAJ04100tr17','subs18','tr34','tr1619');
Do a
A=strcat(path1, path_user1, path_amostra_user1, path_exp_1)
To reach the path
C:\Users\Windows\Desktop\H\user1_SAMPLES_h.fid\procpar
So, A=<6x90 char>
Then I read the procpar files with for example a text scan
for i=1:6
TEXT(i,:)=textread(A(i,:),’%s’);
end
TEXT=<6x10 double>
In this case we have all the folders on my pc. If for example in the exp2 path_exp_2 =char('_hmbc.fid'); we don’t have all the folders sample only ‘PA06F9ppt' ,'PA06F13tr12'and 'PAJ04100tr17' When the textscan is going to find the path were the sample 'subs18','tr34', its give an error because in this experiment don’t have this path ??? Error using ==> textread at 167 File not found. How I can fix that and associate the name of the samples that’s exists to the values of that
0 Kommentare
Akzeptierte Antwort
Titus Edelhofer
am 3 Jul. 2011
Hi,
you can use
exist(path1, 'dir')
if a folder exists and
exist(A(i,1), 'file')
to test if the file exists.
Titus
0 Kommentare
Weitere Antworten (1)
Jan
am 3 Jul. 2011
Creating a CHAR array pads the strings with spaces, such that all have the same length:
path_amostra_user1 = char('PA06F9ppt', 'PA06F13tr12', ...
'PAJ04100tr17', 'subs18', 'tr34', 'tr1619');
Now the line containing 'tr34' has 7 trailing spaces. But I assume the filename does not have these spaces. If this is the problem, use a cell string instead.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!