i want to create a error msage.

I want to run a program where a excel file will be taken as input and i want that if the excel file is not find there should be an error msg. how can i create that type of error msg box. please help me. thank you in advance..

 Respuesta aceptada

Chirag Gupta
Chirag Gupta el 13 de Jul. de 2011

0 votos

Use exist
if (~exist(filename,'file'))
msgbox('File Not found','Error','Error');
end

1 comentario

partha das
partha das el 13 de Jul. de 2011
it is also not working where file name is variable.

Iniciar sesión para comentar.

Más respuestas (1)

Friedrich
Friedrich el 13 de Jul. de 2011

0 votos

Hi,
maybe something like this?
msgbox('File not found','Error','Error')

4 comentarios

partha das
partha das el 13 de Jul. de 2011
but what should be the condition before this msg... dat wat i want to know plz inform. thank you
Chirag Gupta
Chirag Gupta el 13 de Jul. de 2011
If you wanted to throw a MATLAB error use, error('File Not found')
Friedrich
Friedrich el 13 de Jul. de 2011
if exist('C:\path_to file_\name.xls','file') ~=2
msgbox('File not found','Error','Error')
else
%do what you like with the file here
partha das
partha das el 13 de Jul. de 2011
but here file name is variable....so its not working..

Iniciar sesión para comentar.

Categorías

Más información sobre Data Import from MATLAB en Centro de ayuda y File Exchange.

Productos

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by