MATLAB Answers


check status of csvread

Asked by HD
on 3 May 2016
Latest activity Commented on by HD
on 4 May 2016
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.


Sign in to comment.

1 Answer

Answer by Guillaume
on 3 May 2016

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

  1 Comment

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

Sign in to comment.