How do you set the dimensions of an excel plot using activex from MATLAB?

A
ava.smith01 · Sep 1, 2020 · 2.4K views
Question
I have constructed a xyscatter plot in excel using activex from matlab code but cant figure out how to dimension it. Here is the code that I have: Workbooks = Excel.Workbooks; Workbook = Workbooks.Add; Sheets = Excel.ActiveWorkBook.Sheets; sheet1 = get(Sheets, 'Item', 1); Activesheet = Excel.Activesheet; Range = 'A1:B10'; Data(:,1) = 1:10'; Data(:,2) = Data(:,1).^2; ActivesheetRange = get(Activesheet,'Range',Range); set(ActivesheetRange, 'Value', Data); Chart = invoke(Workbook.Charts,'Add'); Excel.ActiveChart.ChartType = 'xlXYScatterLinesNoMarkers'; invoke(Chart, 'SetSourceData', ActivesheetRange); Chart.Location('xlLocationAsObject', 'Sheet1');
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 13, 2026

I found what works:

 

 Excel.ActiveChart.Parent.Top = 50;
 Excel.ActiveChart.Parent.Left = 500;
 Excel.ActiveChart.Parent.Width = 600;
 Excel.ActiveChart.Parent.Height = 300;
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!