<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255207</link>
    <title>MATLAB Central Newsreader - More details -- actxserver('excel.application')</title>
    <description>Feed for thread: More details -- actxserver('excel.application')</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 02 Jul 2009 18:31:02 -0400</pubDate>
      <title>More details -- actxserver('excel.application')</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255207#662311</link>
      <author>Andy Eisenberg</author>
      <description>I'm trying to write a GUI in MATLAB that should have the ability to read from and write to an Excel spreadsheet arbitrarily.  (By that I mean, given a range in a spreadsheet, I should be able to load the data into MATLAB from the spreadsheet.  Or, given a range and an array that fits the range, I should be able to write that array to that range.)  The problem I'm having is one of documentation.  The MATLAB online documentation goes as far as establishing the connection between MATLAB and Excel, namely:&lt;br&gt;
&lt;br&gt;
e = actxserver ('Excel.Application')&lt;br&gt;
e.Visible = 1;&lt;br&gt;
eWorkbooks = e.Workbooks&lt;br&gt;
w = eWorkbooks.Add&lt;br&gt;
e.Quit;&lt;br&gt;
e.delete;&lt;br&gt;
&lt;br&gt;
Elsewhere I've found things like:&lt;br&gt;
&lt;br&gt;
exl = actxserver('excel.application');&lt;br&gt;
exlWkbk = exl.Workbooks; &lt;br&gt;
exlFile = exlWkbk.Open([docroot '/techdoc/matlab_external/examples/input_resp_data.xls']);&lt;br&gt;
exlSheet1 = exlFile.Sheets.Item('Sheet1');&lt;br&gt;
robj = exlSheet1.Columns.End(4);&lt;br&gt;
numrows = robj.row;&lt;br&gt;
dat_range = ['A1:G' num2str(numrows)]; &lt;br&gt;
rngObj = exlSheet1.Range(dat_range);&lt;br&gt;
exlData = rngObj.Value; &lt;br&gt;
exl.registerevent({'WorkbookBeforeClose',@close_event1});&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
But I only sort of understand this code because I can't find documentation for the methods/properties anywhere.  The expression exlSheet1.Columns.End(4) does the right thing, but I don't know why.&lt;br&gt;
&lt;br&gt;
Is there somewhere where I can find more complete documentation on the Excel objects, including documentation on their methods, properties, and common usage?  I am not against Reading The Fantastic Manuals, if only I could find them.&lt;br&gt;
&lt;br&gt;
Thanks in advance for your help.</description>
    </item>
    <item>
      <pubDate>Thu, 02 Jul 2009 19:16:18 -0400</pubDate>
      <title>Re: More details -- actxserver('excel.application')</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255207#662332</link>
      <author>ImageAnalyst</author>
      <description>On Jul 2, 2:31&#160;pm, &quot;Andy Eisenberg&quot; &amp;lt;theorigam...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; I'm trying to write a GUI in MATLAB that should have the ability to read from and write to an Excel spreadsheet arbitrarily. &#160;(By that I mean, given a range in a spreadsheet, I should be able to load the data into MATLAB from the spreadsheet. &#160;Or, given a range and an array that fits the range, I should be able to write that array to that range.) &#160;The problem I'm having is one of documentation. &#160;The MATLAB online documentation goes as far as establishing the connection between MATLAB and Excel, namely:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; e = actxserver ('Excel.Application')&lt;br&gt;
&amp;gt; e.Visible = 1;&lt;br&gt;
&amp;gt; eWorkbooks = e.Workbooks&lt;br&gt;
&amp;gt; w = eWorkbooks.Add&lt;br&gt;
&amp;gt; e.Quit;&lt;br&gt;
&amp;gt; e.delete;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Elsewhere I've found things like:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; exl = actxserver('excel.application');&lt;br&gt;
&amp;gt; exlWkbk = exl.Workbooks;&lt;br&gt;
&amp;gt; exlFile = exlWkbk.Open([docroot '/techdoc/matlab_external/examples/input_resp_data.xls']);&lt;br&gt;
&amp;gt; exlSheet1 = exlFile.Sheets.Item('Sheet1');&lt;br&gt;
&amp;gt; robj = exlSheet1.Columns.End(4);&lt;br&gt;
&amp;gt; numrows = robj.row;&lt;br&gt;
&amp;gt; dat_range = ['A1:G' num2str(numrows)];&lt;br&gt;
&amp;gt; rngObj = exlSheet1.Range(dat_range);&lt;br&gt;
&amp;gt; exlData = rngObj.Value;&lt;br&gt;
&amp;gt; exl.registerevent({'WorkbookBeforeClose',@close_event1});&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; But I only sort of understand this code because I can't find documentation for the methods/properties anywhere. &#160;The expression exlSheet1.Columns.End(4) does the right thing, but I don't know why.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Is there somewhere where I can find more complete documentation on the Excel objects, including documentation on their methods, properties, and common usage? &#160;I am not against Reading The Fantastic Manuals, if only I could find them.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thanks in advance for your help.&lt;br&gt;
&lt;br&gt;
-----------------------------------------------------------------------------------------------------------------------------&lt;br&gt;
Andy:&lt;br&gt;
Here's the Excel 2007 Developer Reference&lt;br&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb242656.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/bb242656.aspx&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
It came from the &quot;Learn&quot; tab of the Microsoft Office Developer Center&lt;br&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/office/default.aspx&quot;&gt;http://msdn.microsoft.com/en-us/office/default.aspx&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
There's a boatload of stuff there, but it's a place to start.&lt;br&gt;
Good luck,&lt;br&gt;
ImageAnalyst</description>
    </item>
    <item>
      <pubDate>Thu, 02 Jul 2009 19:22:25 -0400</pubDate>
      <title>Re: More details -- actxserver('excel.application')</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255207#662334</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;Andy Eisenberg&quot; &amp;lt;theorigamist@gmail.com&amp;gt; wrote in message &lt;br&gt;
news:h2iud6$c94$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; I'm trying to write a GUI in MATLAB that should have the ability to read &lt;br&gt;
&amp;gt; from and write to an Excel spreadsheet arbitrarily.  (By that I mean, &lt;br&gt;
&amp;gt; given a range in a spreadsheet, I should be able to load the data into &lt;br&gt;
&amp;gt; MATLAB from the spreadsheet.  Or, given a range and an array that fits the &lt;br&gt;
&amp;gt; range, I should be able to write that array to that range.)  The problem &lt;br&gt;
&amp;gt; I'm having is one of documentation.  The MATLAB online documentation goes &lt;br&gt;
&amp;gt; as far as establishing the connection between MATLAB and Excel, namely:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; e = actxserver ('Excel.Application')&lt;br&gt;
&amp;gt; e.Visible = 1;&lt;br&gt;
&amp;gt; eWorkbooks = e.Workbooks&lt;br&gt;
&amp;gt; w = eWorkbooks.Add&lt;br&gt;
&amp;gt; e.Quit;&lt;br&gt;
&amp;gt; e.delete;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Elsewhere I've found things like:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; exl = actxserver('excel.application');&lt;br&gt;
&amp;gt; exlWkbk = exl.Workbooks;&lt;br&gt;
&amp;gt; exlFile = exlWkbk.Open([docroot &lt;br&gt;
&amp;gt; '/techdoc/matlab_external/examples/input_resp_data.xls']);&lt;br&gt;
&amp;gt; exlSheet1 = exlFile.Sheets.Item('Sheet1');&lt;br&gt;
&amp;gt; robj = exlSheet1.Columns.End(4);&lt;br&gt;
&amp;gt; numrows = robj.row;&lt;br&gt;
&amp;gt; dat_range = ['A1:G' num2str(numrows)];&lt;br&gt;
&amp;gt; rngObj = exlSheet1.Range(dat_range);&lt;br&gt;
&amp;gt; exlData = rngObj.Value;&lt;br&gt;
&amp;gt; exl.registerevent({'WorkbookBeforeClose',@close_event1});&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; But I only sort of understand this code because I can't find documentation &lt;br&gt;
&amp;gt; for the methods/properties anywhere.  The expression &lt;br&gt;
&amp;gt; exlSheet1.Columns.End(4) does the right thing, but I don't know why.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Is there somewhere where I can find more complete documentation on the &lt;br&gt;
&amp;gt; Excel objects, including documentation on their methods, properties, and &lt;br&gt;
&amp;gt; common usage?  I am not against Reading The Fantastic Manuals, if only I &lt;br&gt;
&amp;gt; could find them.&lt;br&gt;
&lt;br&gt;
Take a look at this section in the documentation:&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/brd4at8.html&quot;&gt;http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/brd4at8.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Those methods and properties, like Workbooks, Open, Sheets, etc. are part of &lt;br&gt;
Excel's COM interface.  If you're looking for more information on those &lt;br&gt;
methods and properties (not how to use methods and properties in MATLAB) I &lt;br&gt;
think you're going to need to dig through the Microsoft Office Development &lt;br&gt;
documentation on Microsoft's website:&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb726434.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/bb726434.aspx&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com </description>
    </item>
    <item>
      <pubDate>Thu, 02 Jul 2009 19:48:01 -0400</pubDate>
      <title>Re: More details -- actxserver('excel.application')</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255207#662347</link>
      <author>Andy Eisenberg</author>
      <description>Thanks for the help.  I'll get started reading through the developer reference.</description>
    </item>
    <item>
      <pubDate>Mon, 06 Jul 2009 17:58:02 -0400</pubDate>
      <title>Re: More details -- actxserver('excel.application')</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255207#662999</link>
      <author>Andy Eisenberg</author>
      <description>I'm going to need a little more help with this.  I'm writing a GUI that should allow the user to enter Excel formulas and add new columns to a spreadsheet whose values are the result of those formulas.  For the purpose of testing, I have a spreadsheet with one column with 50 rows containing the numbers 1 through 50.  I would like the B column to be 5 times the A column.  I can do this in less-than-elegant ways, such as:&lt;br&gt;
&lt;br&gt;
e=actxserver('excel.application');&lt;br&gt;
eWkbk=e.Workbooks;&lt;br&gt;
eFile=eWkbk.Open(filename);&lt;br&gt;
sheet=exlFile.Sheets.Item(1);&lt;br&gt;
range='A1:A50';&lt;br&gt;
newrange='B1:B50';&lt;br&gt;
sheet.Range(newrange).Value=['=5*' range];&lt;br&gt;
&lt;br&gt;
I don't like this for a few reasons.&lt;br&gt;
1) I entered the ranges explicitly.  The following worked:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;robj=sheet.Columns.End(4);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;numrows=robj.row;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;range=['A1:A' num2str(numrows)];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;newrange=['B1:B' num2str(numrows)];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sheet.Range(newrange).Value=['=5*' range];&lt;br&gt;
But I don't know why this worked since I can't find the syntax 'End(4)' in the Excel 2003 Developer's Reference (&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa272268(office.11).aspx).&quot;&gt;http://msdn.microsoft.com/en-us/library/aa272268(office.11).aspx).&lt;/a&gt;  All I found was this: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa214585(office.11).aspx,&quot;&gt;http://msdn.microsoft.com/en-us/library/aa214585(office.11).aspx,&lt;/a&gt; which gives xlUp, xlDown, xlToRight, and xlToLeft as potential arguments to End.  &lt;br&gt;
&lt;br&gt;
2) Although the output was correct (B=5*A), the cells didn't appear the same as if I had just done this in Excel.  For example, if I go to Excel and click in B10, the formula looks like '=5*A10:A59' rather than '=5*A10'.&lt;br&gt;
&lt;br&gt;
Any help would be much appreciated.</description>
    </item>
    <item>
      <pubDate>Mon, 06 Jul 2009 18:29:02 -0400</pubDate>
      <title>Re: More details -- actxserver('excel.application')</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255207#663004</link>
      <author>Ilya Rozenfeld</author>
      <description>To get the right formulas you need to create a cell array of strings or use loop&lt;br&gt;
e.g.&lt;br&gt;
&lt;br&gt;
for jj = 1:50&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;sheet.Range(['B' num2str(jj)]).Value=['=5*A'  num2str(jj)];&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Andy Eisenberg&quot; &amp;lt;theorigamist@gmail.com&amp;gt; wrote in message &amp;lt;h2tdva$20o$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I'm going to need a little more help with this.  I'm writing a GUI that should allow the user to enter Excel formulas and add new columns to a spreadsheet whose values are the result of those formulas.  For the purpose of testing, I have a spreadsheet with one column with 50 rows containing the numbers 1 through 50.  I would like the B column to be 5 times the A column.  I can do this in less-than-elegant ways, such as:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; e=actxserver('excel.application');&lt;br&gt;
&amp;gt; eWkbk=e.Workbooks;&lt;br&gt;
&amp;gt; eFile=eWkbk.Open(filename);&lt;br&gt;
&amp;gt; sheet=exlFile.Sheets.Item(1);&lt;br&gt;
&amp;gt; range='A1:A50';&lt;br&gt;
&amp;gt; newrange='B1:B50';&lt;br&gt;
&amp;gt; sheet.Range(newrange).Value=['=5*' range];&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I don't like this for a few reasons.&lt;br&gt;
&amp;gt; 1) I entered the ranges explicitly.  The following worked:&lt;br&gt;
&amp;gt;         robj=sheet.Columns.End(4);&lt;br&gt;
&amp;gt;         numrows=robj.row;&lt;br&gt;
&amp;gt;         range=['A1:A' num2str(numrows)];&lt;br&gt;
&amp;gt;         newrange=['B1:B' num2str(numrows)];&lt;br&gt;
&amp;gt;         sheet.Range(newrange).Value=['=5*' range];&lt;br&gt;
&amp;gt; But I don't know why this worked since I can't find the syntax 'End(4)' in the Excel 2003 Developer's Reference (&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa272268(office.11).aspx).&quot;&gt;http://msdn.microsoft.com/en-us/library/aa272268(office.11).aspx).&lt;/a&gt;  All I found was this: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa214585(office.11).aspx,&quot;&gt;http://msdn.microsoft.com/en-us/library/aa214585(office.11).aspx,&lt;/a&gt; which gives xlUp, xlDown, xlToRight, and xlToLeft as potential arguments to End.  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 2) Although the output was correct (B=5*A), the cells didn't appear the same as if I had just done this in Excel.  For example, if I go to Excel and click in B10, the formula looks like '=5*A10:A59' rather than '=5*A10'.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any help would be much appreciated.</description>
    </item>
    <item>
      <pubDate>Mon, 06 Jul 2009 20:01:05 -0400</pubDate>
      <title>Re: More details -- actxserver('excel.application')</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255207#663022</link>
      <author>Andy Eisenberg</author>
      <description>Yeah, that works.  But I was hoping to avoid looping in favor of a vectorized method.  In this case, there's no point trying to work around this in MATLAB.  It's far simpler to just do this in Excel (that is what it was made for after all), and then pull the resulting data into MATLAB.&lt;br&gt;
&lt;br&gt;
Thanks.</description>
    </item>
    <item>
      <pubDate>Tue, 07 Jul 2009 13:24:01 -0400</pubDate>
      <title>Re: More details -- actxserver('excel.application')</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255207#663223</link>
      <author>Ilya Rozenfeld</author>
      <description>There is nothing wrong with using loops.  But if you like here is vectorized version&lt;br&gt;
&lt;br&gt;
N = 50;&lt;br&gt;
x = (1:N)';&lt;br&gt;
exlFormula = arrayfun(@(x) ['=5*A'  num2str(x)], x, 'uni', 0);&lt;br&gt;
sheet.Range(['B1:B' num2str(N)]).Value = exlFormula;&lt;br&gt;
&lt;br&gt;
&quot;Andy Eisenberg&quot; &amp;lt;theorigamist@gmail.com&amp;gt; wrote in message &amp;lt;h2tl61$9u4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Yeah, that works.  But I was hoping to avoid looping in favor of a vectorized method.  In this case, there's no point trying to work around this in MATLAB.  It's far simpler to just do this in Excel (that is what it was made for after all), and then pull the resulting data into MATLAB.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks.</description>
    </item>
  </channel>
</rss>

