Rank: 38887 based on downloads (last 30 days) and 0 files submitted
photo

Peter Lindberg

E-mail
Company/University
Skelleftea Kraft
Lat/Long
64.75, 20.96

Personal Profile:

Happy developer

Professional Interests:
Database communication, reports

 

Watch this Author's files

 

Comments and Ratings by Peter View all
Updated File Comments Rating
27 Aug 2009 xlswritefig Write a MATLAB figure to a Microsoft Excel spreadsheet. Author: Scott Hirsch

27 Aug 2009 xlswritefig Write a MATLAB figure to a Microsoft Excel spreadsheet. Author: Scott Hirsch

I've added a "add a new worksheet function":

WorkSheets = Excel.sheets;
message = struct('message',{''},'identifier',{''});

try
    Sheets = Excel.ActiveWorkBook.Sheets;
    target_sheet = get(Sheets, 'Item', sheetname);
catch %#ok<CTCH> Suppress so that this function works in releases without MException
    % Error if the sheet doesn't exist. It would be nice to create it, but
    % I'm too lazy.
    % The alternative to try/catch is to call xlsfinfo to see if the sheet exists, but
    % that's really slow.
    disp(['Sheet ' sheetname ' does not exist!']);
    Sheet = invoke(WorkSheets,'Add')
    Sheet.name = sheetname
    target_sheet = Sheet
end;

 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com