The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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" <> wrote in message <k92qrk$1eu$>...
> "Edwardo " <> wrote in message
> news:k8rmsi$70c$

> > 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
> To contact Technical Support use the Contact Us link on

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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.