Prev: function
Next: text not saving from figure
From: Walter Roberson on 19 Jul 2010 12:35 Maxx Chatsko wrote: > Walter Roberson <roberson(a)hushmail.com> return >> You can represent the tab character in an sprintf format by the >> character pair \t >> >> Each sprintf call needs () around its arguments. You can include >> several lines of error dialog by using {} around the list. >> >> errordlg({sprintf('No %s data on file. Troubleshoot:', tab) ... >> sprintf('\t1) Update PSL Master Sheet)' }); >> >> >> I am not certain, though, that \t will produce more than a small bit >> of empty space for errordlg() purposes. > > I'm sorry, tab is a variable that represents an acquisition type > (fci, rci, or swir). The problem is with char(10). It doesn't seem to > like being on either side of (),{}... char(10) is the ascii newline character. If you are trying to break up the lines to be presented, then just do as I did above, construct a cell array of strings. Just remove the \t from my mini-example and run that as as test (after defining "tab" of course.)
From: Andy on 19 Jul 2010 12:48 > The images are opened based upon the user selection in a listbox. Since multiple images are opened (up to 15) and have their spectral data averaged and displayed on the same plot, isn't it the best way??? > Maxx I seem to be misunderstanding something. Where does Excel come in? Where are the users incorrectly typing in file names? As for this: errordlg(sprintf{'No %s data on file. Troubleshoot:',tab} char(10)... {' 1) Update PSL Master Sheet with latest data' char(10)... ' 2) Check spelling of filenames in PSL Master Sheet ' char(10)... }sprintf{'Please uncheck %s box to continue.',tab}),'FCI Data Error'); There are many syntax errors here. sprintf is a function, so a call to it looks like sprintf(args), not sprintf{args}. errordlg takes a string or cell array of strings, whereas you seemed to concatenate a string with a cell array. Also, using a cell array, you don't need explicit char(10) to get line breaks. It should look something like the following: errordlg({ sprintf('No %s data on file. Troubleshoot:', tab) ; ' 1) Update PSL Master Sheet with latest data'; ' 2) Check spelling of file names in PSL Master Sheet'; sprintf('Please uncheck %s box to continue.', tab)});
From: Maxx Chatsko on 19 Jul 2010 13:01
Walter Roberson <roberson(a)hushmail.com> > char(10) is the ascii newline character. If you are trying to break up > the lines to be presented, then just do as I did above, construct a cell > array of strings. Just remove the \t from my mini-example and run that > as as test (after defining "tab" of course.) Right char(10) gets a new line and was in the code before I got to it. Apparently I don't need it. Thanks Walter and Andy. Maxx PS xlsread works fine and has nothing to do with the problem |