4.5

4.5 | 2 ratings Rate this file 103 downloads (last 30 days) File Size: 2.42 KB File ID: #24424

xlswritefig

by Scott Hirsch

 

12 Jun 2009

Code covered by BSD License  

Write a MATLAB figure to a Microsoft Excel spreadsheet.

Download Now | Watch this File

File Information
Description

XLSWRITEFIG allows you to programmatically place a MATLAB figure inside of an Excel spreadsheet. This can be a useful supplement to XLSWRITE.

MATLAB release MATLAB 7.6 (R2008a)
Other requirements Runs on Microsoft Windows only. Requires Excel.
Zip File Content  
Other Files license.txt,
xlswritefig.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
27 Aug 2009 Peter Lindberg

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;

27 Aug 2009 Peter Lindberg  
02 Sep 2009 Anand

Hello Scott,

Thanks for the M-File. Its very helpful.

I had few queries:
1. Can we resize the figure in Excel automatically.
2. I am running a loop, so the same set of instructions are iterated. Is there any way by which we could advance the cell where the figure has to be saved.

Any help is appreciated.

Thanks
Anand

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
excel Scott Hirsch 02 Jul 2009 15:18:45
data export Scott Hirsch 02 Jul 2009 15:18:46
 

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