Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

error message for wrong data loaded

Asked by Lenka Misenkova on 14 May 2013

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:

if (a==1)
 X = loaddata(:,1)
 y = loaddata(:,2)
if (a==2)
X = loaddata(:,1:2)
y = loaddata(:,3)

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


Lenka Misenkova


No products are associated with this question.

1 Answer

Answer by Walter Roberson on 14 May 2013

See error() and warning() and warndlg() and disp() and fprintf()


Walter Roberson on 19 May 2013
if ndim(loaddata) ~= 2 | size(loaddata,2) ~= 3
Lenka Misenkova on 20 May 2013

Thank you ver much that works

Walter Roberson on 20 May 2013

If your difficulty is solved, please mark this Answer as Accepted.

Walter Roberson

Contact us