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: How to save matrices in a file, effective way
Replies: 4   Last Post: Nov 28, 2012 10:15 AM

Advanced Search

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

Posts: 7
Registered: 11/24/12
Re: How to save matrices in a file, effective way
Posted: Nov 27, 2012 7:31 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Steven_Lord" <slord@mathworks.com> wrote in message <k92qrk$1eu$1@newscl01ah.mathworks.com>...
> "Edwardo " <edwardo.rivera@upr.edu> wrote in message
> news:k8rmsi$70c$1@newscl01ah.mathworks.com...

> > Hi,
> >
> > I a doing a program that multiplies a lot of matrices. All the matrices
> > are stores in a cell matrix. where:
> >
> > cell(index,1) is the matrix in the left cell(index,2)is the matrix of the
> > right
> > cell(index,3) is the result.
> > I want to save a lot of matrices in this way in a file (example):
> >
> > cell(index,1) cell(index,2) = cell(index,3)
> > cell(index,1) cell(index,2) = cell(index,3)
> > cell(index,1) cell(index,2) = cell(index,3)
> > and so on.
> >
> > I know that exist the function dlmwrite, but I dont know exactly how to
> > use it so that I can have this format.

> If you want more control over the specific format with which your data is
> written to the file, look at the FPRINTF function.
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

I tried this:
for index=1:size(cell,1)
fprintf(fid,"%i %i = %i\n",cell(index,1),cell(index,2),cell(index,3));

but first, I have to convert the matrix that was in the cell, to a matrix (cell2matrix). But the output to the file was bad. it print a matrix, in a line...

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

[Privacy Policy] [Terms of Use]

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