Draw a pie chart script written in Matlab using Excel. Work with COM \ VBA

I need to write a script in Matlab that will read some data from an Excel spreadsheet and draw a pie chart in a Matlab shape. However, I was recommended to draw it using Excel tools. It's easy to draw a pie chart in Excel, but I still haven't found a way to get it to work from Matlab using a Matlab shape. I already asked this question in other forums, but did not receive an answer. I will be very grateful for any help.

+3
source share
2 answers

So, I figured out how to use the ActiveX control in a Matlab figure.

-, mschrt20.ocx( ). 32- C:/System32, , "regsvr32 mschrt20.ocx" cosole ( Administrator).

Matlab ActiveX, . Matlab, :

 anyone = actxcontrol('MSChart20Lib.MSChart.2');
 anyone.get;
 get(anyone,'ChartData')

. charType "Legend" "Visible", .

ActiveX, "ChartData". 2xn. , :

   S = cell(2, 3);
   S(1,: ) = {'first', 'second', 'third'} ; %legend
   S(2,: ) = {1, 10, 5} ; %meanings
   set(handles.activex1,'ChartData', S);

. , ActiveX.

+2

:

, Matlab "pie":

http://www.mathworks.com/help/techdoc/ref/pie.html

x = [1 3 0.5 2.5 2];
explode = [0 1 0 0 0];
pie(x,explode)
colormap jet

, "rectangle" "Curvature" :

rectangle('Position',[1,2,5,10],'Curvature',[1,1],...
          'FaceColor','r')
daspect([1,1,1])
xlim([0,7])
ylim([1,13])

:

http://blogs.mathworks.com/pick/2008/03/21/drawing-a-circle/ http://www.mathworks.com/matlabcentral/fileexchange/2876

:

http://www.mathworks.com/help/techdoc/ref/polar.html

figure
t = 0:.01:2*pi;
polar(t,sin(2*t).*cos(2*t),'--r')

The following is the equation for the circle (and therefore you will see a red circle superimposed on the axis of the black polar graph:

polar(t,sin(t).^2+cos(t).^2,'--r')
0
source

All Articles