Print and resize MATLAB in Excel

I have two figures in MATLAB with hFig1and handles hFig2. I would like to print them in specific cells in Excel (cells E3 and I3) and change them for each of them [2in x 3in].

I tried using an object handler .AddPicturesand using print -dmeta, but I can’t find a way to achieve all three of my goals.

I also write data to succeed at the same time, and because many rows of data were sent, I hoped to have a method that did not require a constant excel call using ActiveXServer.

Does anyone have a good method or resource for this kind of problem?

+2
source share
1

MATLAB Excel :

% Create some arbitrary graphics
f1 = figure; peaks; f2 = figure; membrane;

% Connect to Excel, make it visible and add a worksheet
xl = actxserver('Excel.Application'); set(xl,'Visible',1);
xl.Workbooks.Add(1); xls = xl.ActiveSheet;

% Paste in the MATLAB figures
print(f1, '-dbitmap'); xls.Range('E3').PasteSpecial;
print(f2, '-dbitmap'); xls.Range('I3').PasteSpecial;

, , 2in 3in. ? ? ?

:

xls.Shapes.Item(1).PictureFormat.CropLeft  = 30;
xls.Shapes.Item(1).PictureFormat.CropRight  = 30;
xls.Shapes.Item(1).Height  = 200;
xls.Shapes.Item(1).Left = xls.Range('E3').Left;

, , , .

, Excel actxserver; , ? , , - , , .

Excel Microsoft . , :)

+3

Source: https://habr.com/ru/post/1684236/


All Articles