フィルターのクリア

Insert multiple plots to excel sheets using ActiveX

1 回表示 (過去 30 日間)
Fredrik
Fredrik 2012 年 10 月 30 日
Hi, I have a function where I create about 30 plots in a for loop. Now I would like to put each plot, as a pitcture, into a seperate excel sheet in the same excel document.
, they show how to do it for one plot, but as I dont want to write sheet1.... sheet 2.... sheet 3 and so on, I wonder if there is a way to to this in a for loop to make things a bit more convenient!
Thank's a lot! Fredrik

採用された回答

Eric
Eric 2012 年 10 月 30 日
編集済み: Eric 2012 年 10 月 30 日
First create as many sheets as you want (using Sheets.Add()).
Then loop through your plots, calling
Sheet1 = get(Sheets, 'Item', ctr);
where I have assumed ctr is the loop variable. Sheet1 (or call it something else if you like) will then be a reference to the ctr-th Worksheet.
So you could do something like:
for ctr = 1:N
Sheets.Add(); %Add a new sheet each time through the loop
Sheet1 = Sheets.Item(ctr); %Extract the ctr-th Worksheet
... %Plotting code here& ...
end
Good luck,
-Eric
  1 件のコメント
Fredrik
Fredrik 2012 年 10 月 30 日
Thanks a lot!
I managed to do something similar with the help of other functions but I think this would be even better..
/Fredrik

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by