Info

此问题已关闭。 请重新打开它进行编辑或回答。

problem with error message when wrong data are 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. For example when the user set value a(to be equal to 2) that means that his data are supposed to have 2 dependendent variable and one independent variable. It means that his data have 3 columns. So imagine that he sat that he have 2 independent variables but he mistankely load data which have for example 4 or 5 columns or more. Do you guys have any idea how can I fix it ?

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by