Question: Getting data from 2D plots and 3Dplots 

I want to get data from 2D plots and 3Dplots and want to export to Excel or Matlab.

 

For  2D plots, the following code works. The data can be exported to Excel. No problem.

restart: 

P1:=plot(sin(x));
data1:=op([1,1],P1); 

ExcelTools:-Export(data1, "C:/Users/student/Desktop/XLdat.csv", "Sheet1", "A1");
ExportMatrix("C:/Users/student/Desktop/XLdat.csv", data1); 

 

1. But the following code doesn' t work for exporting the data to Matlab. Why?

restart: P1:=plot(sin(x));
dataMat:=plottools:-getdata(P1);
dataMat2:=convert(dataMat,Matrix):
ExportMatrix( "test.mat",dataMat2, target=Matlab);

 

 

 2. How to write a code in order to get data from the 3D plot and to export to Excel or Matlab?

For example;

restart:
z=sin(x)*cos(y);
P2:=plot3d(z);

 

 

Maple 2020.2

Please Wait...