check status of csvread

Hi, is there any way to check a status of the csvread function ? I am using guide in matlab, I would like to check if there is an error after reading a file to make an error message.
Thank you.

Réponses (1)

Guillaume
Guillaume le 3 Mai 2016

0 votes

Wrap the call to csvread in a try ... catch block:
try
m = csvread('somefile.txt');
catch exception
fprintf('Failed to read csv file because %s', exception.message);
end

1 commentaire

HD
HD le 4 Mai 2016
Hi Guillaume, this is not working. Is it because I am using guide ?
Thank you

Connectez-vous pour commenter.

Question posée :

HD
le 3 Mai 2016

Commenté :

HD
le 4 Mai 2016

Community Treasure Hunt

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

Start Hunting!

Translated by