Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Output cell array
Replies: 3   Last Post: Nov 8, 2012 7:22 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Justin Ashmall

Posts: 20
Registered: 8/16/12
Re: Output cell array
Posted: Nov 8, 2012 7:22 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

> outvec={64927 3051114511.00000 5.11772042811932e-10 1953994975.00000 'string'}
>
> Tried using save function.

> >> save 'output.txt' outvec -ascii
>

It's not much help, but this is expected. From "doc save" for ascii files:
* Each variable must be a two-dimensional double or character array.

i.e. cell arrays are not supported.

In general, saving a cell array that contains mixed numbers and strings is not particularly simple in MATLAB. Your best best is to store the numbers and strings in separate arrays, and then use save() or dlmwrite() for example.

If you want to use a mixed cells array, try reading this for an example:
http://www.mathworks.com/help/matlab/import_export/write-to-delimited-data-files.html#br2ypq2-1

Or take a look on the file exchange - I can see some functions there.

Justin



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.