Prev: function
Next: text not saving from figure
From: Maxx Chatsko on 19 Jul 2010 11:28 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 19 Jul 2010 11:35 "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 19 Jul 2010 11:37 "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 19 Jul 2010 11:45 "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 19 Jul 2010 11:47
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? |