# Question:How to export result from Optimization[NLPSolve]

## Question:How to export result from Optimization[NLPSolve]

I can't cut and paste from my maple worksheet (because syntax somehow gets changed in the process), so perhaps the following attempt at carefully worded  prose will do (alternately, please someone tell me how to attach screen shots).  Here goes...

I execute

The optimization succeeds and the assignment takes place.  The result is what I'ld like to cut and paste so youall can see...  it looks as follows. 'r:=' (but no quotes)  followed by open square bracket, then a number, then a comma, then another open square bracket, then a vertically arranged list of stuff, then two close brackets.  I presume the vertically arranged stuff in the innermost matching square brackets somehow represents the point in the search space where the minimum takes place, and the minimum is the number that follows the first square bracket and is before the comma.  My goal is to write to disk the the point in the search space where the minimum takes place (I suppose that vector is in some sense r[2]) .  My attempt to write it to disk is

ExportMatrix("maple.txt", r[2], target = auto)

but maple complains

ExportMatrix("maple.txt", r, target = auto);
Error, invalid input: ExportMatrix expects its 2nd argument, M, to be of type {Matrix, list(Matrix)}, but received [293148935266.099426, Vector(28, {(1) = -233674.34818878854, (2) = 12.62636610207248, (3) = 0.3337043409389546e-2, (4) = 0.13303915611938133e-1, (5) = .0, (6) = .2589485687872699, (7) = 0.9341600279762804e-1, (8) = 0.3293862590239189e-1, (9) = 0.12892649003200331e-1, (10) = 0.606528143324688e-1, (11) = 0.17524827222051658e-1, (12) = -0.16059611469561555e-17, (13) = 0.621465506367271e-1, (14) = .29826235341855, (15) = -0.16288776533795546e-17, (16) = 0.15301368661023716e-1, (17) = 0.1529933711903137e-18, (18) = 0.4375115591744606...

How can I write the result of optimization to disk as a plain ascii text file (tsv format)?

Thanks

﻿