Prev: Need advise on getaudiodata [Is for wav file frequency /pitch extract purpose]
Next: Help in the Fitness Function on GA toolbox
From: Roberto on 2 Aug 2010 06:56 "Roberto " <ivogrunn(a)hotmail.com> wrote in message <i33gmt$p0b$1(a)fred.mathworks.com>... > "james bejon" <jamesbejon(a)yahoo.co.uk> wrote in message <i33695$iho$1(a)fred.mathworks.com>... > > Hard to say exactly what's going wrong here. (I take it Page2 exists as a sheet and has valid data in the relevant cells). You might want to try it keeping the application visible just to see if that makes any difference. You might also want to try using specific Excel methods (like .Workbooks.Open rather than winopen) to see if this makes any difference. Also, might you have any 03/07 issues here? The reason I ask is because Excel 07 has a difference chart object model to Excel 03 (iirc). > > I'm using excel 2003 and making the application visible doesn't make any difference... > The strange thing is that when I run the macro in excel it works fine. But when I let the same macro run by matlab (see the m-code posted previously), it doesn't work. A pop up shows me the problem is the line which set the labels on the x-axis. > > I've also run the same macro without that line by matlab and than it also works fine (but than the labels on the x-axis aren't set like I wanted). So I think it's clear that the problem doesn't have anything to do with excel, the m-code or the macro (except that line). > > If you want to try it yourself, I've posted an excel-file (Macro.xls) right here: > http://www.mijnbestand.nl/Bestand-J7XFQXBS3TMP.xls > The macro contains one worksheet (Blad1) and the macro. If you run the macro from excel, you'll see that it works fine (a new worksheet will be created with some data and the histogram). But if you let the macro run by matlab with the following m-code, you'll see that it doesn't work. > > Excel=actxserver('Excel.Application'); > set(Excel, 'Visible', 0); > winopen('Macro.xls'); > Excel.Run(['''', 'Macro.xls', '''!berekening_alle_runs']); > invoke(Excel, 'Quit'); > clear Workbooks Excel; > > Maybe this could help you to understand the problem or even better to fix it! :) Maybe anyone who could try the macro and the m-code (see previous post)? And let me know whether the problem is only on my computer or if it's a general matlab/excel problem. Cause it's very frustrating not to know what the real problem is...
From: Roberto on 2 Aug 2010 07:14 Whoops... I've posted a wrong excel-file. Sry guys! Here is the right one: http://www.mijnbestand.nl/Bestand-H8XR4Y8WL6GQ.xls So, that's the excel-file with the data on 'Blad1' and the macro. The m-code is: Excel=actxserver('Excel.Application'); set(Excel, 'Visible', 0); winopen('E:\Macro.xls'); Excel.Run(['''', 'Macro.xls', '''!berekening_alle_runs']); invoke(Excel, 'Quit'); clear Workbooks Excel;
From: Andy on 2 Aug 2010 08:44 Have you tried changing the problematic line to: ActiveChart.SeriesCollection.Item(1).XValues = "=Page2!R3C2:R3C46"
From: Roberto on 2 Aug 2010 09:04 "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i36ein$g30$1(a)fred.mathworks.com>... > Have you tried changing the problematic line to: > > ActiveChart.SeriesCollection.Item(1).XValues = "=Page2!R3C2:R3C46" Yup, I've also tried that and it still works when I run it from excel. But when I run it via the m-code, it doesn't work...
From: Andy on 2 Aug 2010 09:31
"Roberto " <ivogrunn(a)hotmail.com> wrote in message <i36fo6$2mf$1(a)fred.mathworks.com>... > "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i36ein$g30$1(a)fred.mathworks.com>... > > Have you tried changing the problematic line to: > > > > ActiveChart.SeriesCollection.Item(1).XValues = "=Page2!R3C2:R3C46" > > Yup, I've also tried that and it still works when I run it from excel. But when I run it via the m-code, it doesn't work... Have you tried replacing the string "=Page2!R3C2:R3C46" with the Range object that represents that range? |