1
$\begingroup$

Sorry for the probably mainstream question, but I have not found the answer I was looking for yet.

I have this Excel file: https://drive.google.com/file/d/1UhkYdoaqXQIsf6opOx-EBgG7xPxxHga3/view and I want to import the two-column data therein, define a function $g(t)$ from their interpolation and plot it.

I have tried simple code lines as

mydata = Import["gstar.xlsx"]
g = Interpolation[mydata]

but it gives me the error message Interpolation::inder: The order-2 derivative of {0.000101685,4.13102} is not a tensor of rank 2 with dimensions 2.

I have also tried with g = ListInterpolation[mydata], but I get ListInterpolation::inhr: Requested order is too high; order has been reduced to {0,3,1}.

I don't understand what are the problems. In fact, if I try to plot the list of data with ListLogLogPlot[mydata] I am able to visualize the data and it seems that the import process was actually successful.

Thank you for your help!

$\endgroup$
3
  • $\begingroup$ Remove the chart from input excel file; or try mydata2 = Import["gstar.xlsx", {"Data", 1, All, ;; 2}]; Interpolation[mydata2]? $\endgroup$
    – kglr
    Aug 22, 2019 at 16:57
  • $\begingroup$ Sorry for the chart, but it doesn't affect the problem. However, it seems that your second method works, thank you! May you explain the syntax {"Data", 1, All, ;; 2} to me? $\endgroup$
    – Lele
    Aug 22, 2019 at 17:16
  • $\begingroup$ Lele, posted the comment as answer. $\endgroup$
    – kglr
    Aug 22, 2019 at 17:30

1 Answer 1

3
$\begingroup$

Try

mydata2 = Import["gstar.xlsx", {"Data", 1, All, ;; 2}]; 
Interpolation[mydata2]

{"Data", sheetlist, rowlist, columnlist} specification extracts data from sheets in sheetlist the rows in rowlist and columns in columnlist. So {"Data", 1, All, ;; 2} says "get the array of data in columns 1 and 2 form all rows of sheet 1".

See XLSX >> Import Elements for further examples.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.