Exporting tables into Matlab
Previous Top Next

Exporting tables into Matlab


To use Matlab: download the files () from the link in () and copy them to ..\Matlab… This free utility will allow you to use MySQL in Matlab using the function 'mysql()'. To start type
mysql('open');

And Matlab should say something like:
Connecting to  host=localhost Uptime: 81473  Threads: 5  Questions: 5529  …

Then type
mysql('use sap');

and Matlab should say “Current database is "sap"” and that's it. You are now ready to type queries.
 

We maintain another method of exporting data to Matlab directly through SAP2, using this method is no longer recommended (using the interface is much faster and more robust). Assuming you have Matlab installed, first, make sure that you know what is the table you want to open. The current table name is presented at the right side of the screen:graphic Click 'Export to Matlab' and open that table. Check the fields you would like to export to Matlab. Note that this procedure can only export fields that contain numbers, but not strings (do not try to export 'file name'!).

 graphic

Then click 'Convert to Matlab' and type the new file a name including '.mat' extension, e.g., MyData.mat .

Note that you can select how many records to copy and where to start from.
Click 'open' and a message saying 'Mat file created successfully' should appear in the text box. Open Matlab and open the mat file. Type
 
MyData=LocalDouble'; % we need to transpose the matrix

 And you are all set.
  

Created using Helpmatic Pro HTML