I wanted to export a figure plotted in MATLAB into a specified cell in Excel. I tried this but it does not work for the last line and I get the following error:
No appropriate method, property, or field Pictures for class Interface.Microsoft_Excel_15.0_Object_Library._Worksheet.
The code is:
% Open Excel file.
objExcel = actxserver('Excel.Application');
objExcel.Workbooks.Open(fullfile('D:\MATLAB', 'x1.xlsx'));
oWB = objExcel.Workbooks.Add();
oSheet = oWB.ActiveSheet;
oSheet.Range('A1').Select;
oSheet.Pictures.Insert('D:\MATLAB\v.jpg').Select(); % This line does not work for me and I get the error above!
Can anyone help me? Is there any other approaches to import the image into Excel from MATLAB? Thanks in advance!