error message for wrong data loaded

1 次查看(过去 30 天)
Hi everybody,
In my GUI I´m loading data and storing them into variables X and y. The a value is entered by user.It looks like that:
[FILENAME,PATHNAME]=uigetfile('*.txt')
loaddata=load(FILENAME)
if (a==1)
X = loaddata(:,1)
y = loaddata(:,2)
end
if (a==2)
X = loaddata(:,1:2)
y = loaddata(:,3)
end
...
But I would like to add an error message in case that user load the wrong data set if he set the value a is equal for example to 1. Do you guys have any idea ? TY for help

回答(1 个)

Walter Roberson
Walter Roberson 2013-5-14
See error() and warning() and warndlg() and disp() and fprintf()
  7 个评论
Walter Roberson
Walter Roberson 2013-5-20
If your difficulty is solved, please mark this Answer as Accepted.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by