On Jan 6, 2012 8:42 AM, "Peter Passaro" <[email protected]> wrote:
>
> Hi All,
>
> By way of introduction, I'm attempting to use Sage to document and
> provide for easy use (via Sagenb) of my own Python codebase for
> neuroscience data analysis, as well organise analysis and simulation
> workflows using a few other Python and Matlab based neuroinformatics
> tools. I'd like some general advice on the best strategies for
> shuttling variables between Sage and Matlab (particularly from within
> notebook cells using the Matlab interface), and some specific advice
> on debugging the issue I describe below.
>
> Prior to working with Sage, I used the scipy.io savemat function to
> create .mat files, then switched over to Matlab to process them, and
> then use loadmat to bring them back into Python. I'd like to use this
> same strategy with Sage and make it fully automated, but I've run into
> a problem passing a file name as a string into the Matlab "load"
> function (the data import function). The way I started implementing it
> is to pass the worksheet DATA directory path to my code and save
> my .mat files there, then tell Matlab to load and process them, and
> pull them back into Sage using loadmat.
>
> In a notebook cell, manually putting the file path in works fine:
>
> %matlab
> load('/Users/myUserName/.sage/sage_notebook.sagenb/home/admin/9/data/
> test1.mat')
> doMyStuffInMatlab
>
> However when I try this:
>
> matlab("load('/Users/myUserName/.sage/sage_notebook.sagenb/home/admin/
> 9/data/test1.mat')")
>
> or try to automate things by passing in strings like this:
> matlab("load('%s')%PathToMatfileString)
>
> The .mat file is not loaded and no Matlab error message is generated,
> but a variable called sage0 of class 'Cell' that contains a string
> 'sage0' is generated in Matlab. Any suggestions on how to resolve
> this?

You should be using matlab.eval

>I've started digging into the matlab interface and expect
> documentation, but any thoughts on where go from here would be greatly
> appreciated.
>
> For completeness... I'm running on Mac OS X 10.6.8, Matlab R2011A, and
> Sage 4.7.2
>
> Best,
> Peter
>
> --
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
[email protected]
> For more options, visit this group at
http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to