What is the effective error block statements when import many kinds of txt data?
Afficher commentaires plus anciens
Hi,
In my function, it import many text data and save it.
data1=importdata('data1.txt');
data2=importdata('data2.txt');
........
data100=importdata('data100.txt');
But in special case, there are some missing txt files so this error msg occurs.
Error using importdata (line 136)
Unable to open file.
so I have to block this error.
To use try/catch, all the 'import data' lines have to add try/catch.
try
data1=importdata('data1.txt');
catch
data1=0;
try
data2=importdata('data2.txt');
catch
data2=0;
........
try
data100=importdata('data100.txt');
catch
data100=0;
This would be very annoying and inefficient method. Is there are idea for solving this problem??
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Large Files and Big Data dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!