This class inherits from double and overloads the display function to output multidimensional arrays in text format that is compatible for copy and pasting into an interactive Python session.
It doesn't quite work with arbitrary dimensions, since I got stuck with generalised indexing, hence the hackish:
newx = squeeze(x(i,:,:,:,:,:,:,:,:,:,:));
(I'd be interested to hear if theres a different way to do this!)
So at the moment it supports about 12 dimensions, which I thought was probably enough for most copy + paste needs, but if you need more you can just add more colons to the line above - it doesn't seem to do any harm!
Anyway with the file in your Matlab path:
>> x = rand(2,3,4,5);
>> a = array(x)
You can specify a fprintf style format string either in the
constructor or after:
>> a = array(x,'%2.6f')
>> a.format = '%2.2f'
>> x = rand(4,3,2);
another silly bug - missing off first element...
Update file - fix problem with column array
More detailed description with an example.
Create scripts with code, output, and formatted text in a single executable document.