Is it possible to import data into MATLAB from a SAS database? - matlab

I'm working on an automation project and was wondering if it's possible to establish a connection between MATLAB and a SAS database?

Yes. For instance, you can use Matlab's sasread function to read from SAS
sasfile = 'C:\sasreaddemo.sas7bdat';
xlsfile = 'C:\SAS-Matlab Converter.xls';
[numeric,text,raw] = sasread(sasfile,xlsfile)
Example files are available:
https://www.mathworks.com/matlabcentral/fileexchange/15835-import-data-from-sas

Related

LibreOffice BASIC : Connect to PostgreSQL

I've created a PostgreSQL connection File using LibreOffice Base (6.1) and I can run SQL Queries in there just fine but I was wondering if it's possible to use this Base connection in a LibreOffice BASIC function.
I know you can use JDBC connections for MySQL
mysql://hostname:port/database_name
But I'm hoping there's a way to use the Base File seeing as it works so well
I've been trying to find documentation on this online but I am struggling to find anything that bridges the gap between BASIC and Base.
I've found the answer, the solution was to use createUnoService and that allows you to specify the name of the odb that was setup in Base.
oService = createUnoService("com.sun.star.sdb.DatabaseContext")
oBase = oService.getByName("basePostgreSQL")
oConn = oBase.getConnection("","")
oQuery = oConn.createStatement()
oSql = "select col from table"
oResult = oQuery.executeQuery(oSql)
while oResult.next()
msgBox oResult.getString(1)
wend
oConn.close()

Write XLSX file - Oracle forms

i am trying to create xlsx file based on block data in oracle forms.
Is it possible to generate xlsx using webutil(Text_io) or by using java beans?
any sample please share me.
thanks
V
In my opinion and experience it is best using UTL_File to generate text file then open it with Excel. You can use Text_IO also. If I find the example I will post it.

Exporting and importing a MATLAB map structure

I'm using the containers.Map-function to store my data.
Is there an easy way to export the whole structure to a file and be able to import it again at a later time.
A structure could be:
keys = {'six','seven','eight','nine'};
vals = {6,7,8,9};
Map = containers.Map(keys,vals);
and then say I want to export this structure and be able to import at a later time (or in another code).
Thanks, regards
Rasmus
Use the save and load functions: http://www.mathworks.com/help/matlab/matlab_env/save-load-and-delete-workspace-variables.html:
save('MyFileName', 'Map');
load('MyFileName');

Accessing files on webserver with Matlab

I have written a Matlab script to perform some analysis on audio samples recorded at different locations. I have a mobile app that records audio and stores it on a web server. Is there a way I can access this file from Matlab as an input to the script? The url and individual file names will be available, I assume there is a Matlab command that uses this information.
Thanks,
Try something like this:
str = urlread('http://stackoverflow.com');

MATLAB and DDE LINKS

I have developed an trade automator in excel, but its too slow, now im trying to do this in matlab.
One of the links I use to feed my sheets in excel is :
=TWSVR|CMA!'0012PETR4;25'
I'm trying to receive the same data in matlab, here is what I did:
channel = ddeinit('TWSVR','CMA')
lastPetr = ddeadv(channel,'0012PETR4;25',callback)
So is this right? Where can I see the data? Where is stored?
This callback function is the one I have to developed to process the data?
Matlab does not support DDE any more. You can still use DDE, but you may run into troubles.
For data exchange with Excel, I would suggest using xlsread, xlswrite and xlsfinfo instead.