From: Maxx Chatsko on
Hello all,
My program extracts filenames from an Excel database. Problem is, when people type the wrong filename into the Excel sheet the program returns the error that the vectors were not the same length. That is because the incorrect filename, in this case an image, does not exist. Since the image doesn't exist its data cannot be read with imread, etc, etc, etc. The error returns the line in the code where it plots the image data WL and master, which obviously won't work if one array is empty.
In an attempt to increase user friendliness and get rid of that awful red text in the command window I would like to display an error telling the user to not be such a dumbass and check their spelling when entering filenames into the database and be thankful that such a database exists.
How can I compare two arrays, WL and master, to make sure they are the same size?
Thanks
Maxx
From: us on
"Maxx Chatsko" <chatskom(a)chemimage.com> wrote in message <i21qu4$5m7$1(a)fred.mathworks.com>...
> Hello all,
> My program extracts filenames from an Excel database. Problem is, when people type the wrong filename into the Excel sheet the program returns the error that the vectors were not the same length. That is because the incorrect filename, in this case an image, does not exist. Since the image doesn't exist its data cannot be read with imread, etc, etc, etc. The error returns the line in the code where it plots the image data WL and master, which obviously won't work if one array is empty.
> In an attempt to increase user friendliness and get rid of that awful red text in the command window I would like to display an error telling the user to not be such a dumbass and check their spelling when entering filenames into the database and be thankful that such a database exists.
> How can I compare two arrays, WL and master, to make sure they are the same size?
> Thanks
> Maxx

a hint:

help isequal; % <- and sibling...

us
From: Sean on
"Maxx Chatsko" <chatskom(a)chemimage.com> wrote in message <i21qu4$5m7$1(a)fred.mathworks.com>...
> Hello all,
> My program extracts filenames from an Excel database. Problem is, when people type the wrong filename into the Excel sheet the program returns the error that the vectors were not the same length. That is because the incorrect filename, in this case an image, does not exist. Since the image doesn't exist its data cannot be read with imread, etc, etc, etc. The error returns the line in the code where it plots the image data WL and master, which obviously won't work if one array is empty.
> In an attempt to increase user friendliness and get rid of that awful red text in the command window I would like to display an error telling the user to not be such a dumbass and check their spelling when entering filenames into the database and be thankful that such a database exists.
> How can I compare two arrays, WL and master, to make sure they are the same size?
> Thanks
> Maxx

assert(all(size(WL)==size(master)),'Don''t be such a dumbass!!');
From: Andy on
"Maxx Chatsko" <chatskom(a)chemimage.com> wrote in message <i21qu4$5m7$1(a)fred.mathworks.com>...
> Hello all,
> My program extracts filenames from an Excel database. Problem is, when people type the wrong filename into the Excel sheet the program returns the error that the vectors were not the same length. That is because the incorrect filename, in this case an image, does not exist. Since the image doesn't exist its data cannot be read with imread, etc, etc, etc. The error returns the line in the code where it plots the image data WL and master, which obviously won't work if one array is empty.
> In an attempt to increase user friendliness and get rid of that awful red text in the command window I would like to display an error telling the user to not be such a dumbass and check their spelling when entering filenames into the database and be thankful that such a database exists.
> How can I compare two arrays, WL and master, to make sure they are the same size?
> Thanks
> Maxx

It seems like an awfully clunky approach to have your user type file names exactly into an Excel file and then try to match those against a database. Is there any reason you're not using uigetfile or some similar approach?
From: Walter Roberson on
Sean wrote:

> assert(all(size(WL)==size(master)),'Don''t be such a dumbass!!');

Sean, what would happen if the two had a different number of dimensions?
 |  Next  |  Last
Pages: 1 2 3
Prev: function
Next: text not saving from figure