[Numpy-discussion] copy and paste arrays from matlab
Tue May 12 08:12:12 CDT 2009
[crossposted to numpy-discussion and mlabwrap-user]
I wrote a little utility class in Matlab that inherits from double and
overloads the display function so you can easily print matlab arrays
of arbitrary dimension in Numpy format for easy copy and pasting.
I have to work a lot with other peoples code - and while mlabwrap and
reading and writing is great, sometimes I find it easier and quicker
just to copy and paste smaller arrays between interactive sessions.
Anyway you put it in your Matlab path then you can do
x = rand(2,3,4,5);
a = array(x)
You can specify the fprintf style format string either in the
constructor or after:
a = array(x,'%2.6f')
a.format = '%2.2f'
>> x = rand(4,3,2);
It's a while since I've tried to do anything like this in Matlab and I
must admit I found it pretty painful, so I hope it can be useful to
I will try and do one for Python for copying and pasting to Matlab,
but I'm expecting that to be a lot easier!
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2103 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090512/8a30e71b/attachment.obj
More information about the Numpy-discussion