clear all; close all; clc;
 
   x= {1:10};
   a= cell2mat(x);
   y= {1:10};
   b= cell2mat(y);
   %............plotting..............................................................................................
   plot(a,b);
   xlabel('X Values');
   ylabel('Y Values');
   print -dmeta;   %.................Copying to clipboard
   FILE  = 'test_plot.xls';
   File_report = strcat(pwd,'\',FILE);
   Range ='J20';
   %.............excel COM object............................................................................
         Excel = actxserver ("Excel.Application");
 Excel.Visible = 1;
 if ~exist(File_report,'file')
       ExcelWorkbook=Excel.Workbooks.Add;
       ExcelWorkbook.SaveAs(FILE);
       ExcelWorkbook.Close(false);
 end
 invoke(Excel.Workbooks,"Open",File_report); %Open the file
 ActiveSheet  = Excel.ActiveSheet;
 ActiveSheetRange  = get(ActiveSheet,"Range",Range);
 ActiveSheetRange.Select;
 ActiveSheetRange.PasteSpecial; %.................Pasting the figure to the selected location