Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to export the data from a B Spline Function to a table in excel. I have tried exporting as many different file types (.xls, .txt, .dat), but all of them show up in excel as all of the data in one cell.

Currently, all I have successfully done is this, showing a plot of "data1", a set of ordered pairs that I imported, and the B-spline fit for this data set.

f = BSplineFunction[data1]
Show[ListLinePlot[data1, PlotStyle -> Red], 
 ParametricPlot[f[t], {t, 0, 1}]]

I would like to export the data from the B-spline function in a way that can be viewed as a table in Excel.

Thank you.

share|improve this question
1  
Can you give us some idea of what data1 looks like? –  bill s May 30 '13 at 14:36
    
data1 is a set of about 500 of these ordered pairs, with the x-coordinate ranging from 0.3 to 12, in varying step sizes: {0.3, 0.0558}, {0.302, 0.0556}, {0.304, 0.0554}, {0.306, 0.0552}, {0.308, 0.0552}, {0.31, 0.055}, {0.312, 0.0548}, {0.314, 0.0546}, {0.316, 0.0544},... –  Mattie May 30 '13 at 14:46
    
Now I don't understand: what do you mean the "data" from the Bspline... this is an interpolating function, it is not data. Do you want values of the f (the B-spline function) at certain points? –  bill s May 30 '13 at 15:14
    
Yes. sorry about that. I am looking for the values of f –  Mattie May 30 '13 at 15:37

1 Answer 1

You probably want to map your function over a suitable list of points which fit the needs of the values you require.

RandomInteger[{1, 10}, {20,2}];

f = BSplineFunction[%]

Export["myfile.tsv",f[#]&/@ Range[0, 1, 0.1]]

{{31., 76.}, {52.4823, 17.653}, {29.8387, 21.6133}, {47.3833, 64.0472}, {39.5027, 23.1}, {53.2083, 46.5833}, {58.128, 67.6787}, {62.9102, 39.1387}, {39.7933, 19.064}, {90.7272, 26.2918}, {21., 66.}}

share|improve this answer
1  
I agree ... switch on brain :) –  image_doctor May 30 '13 at 16:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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