From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: mr roger
Date: Tue, 2 Feb 2010 21:16:19 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <hka4n3$dse$>
References: <gprnm1$rid$> <gprp12$1ta$> <gprqjn$fki$> <gptme1$cj6$> <gptt1t$nvc$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1265145379 14222 (2 Feb 2010 21:16:19 GMT)
NNTP-Posting-Date: Tue, 2 Feb 2010 21:16:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2202990
Xref: comp.soft-sys.matlab:603828

"Roger Stafford" <> wrote in message <gptt1t$nvc$>...
> "dhuan Du" <> wrote in message <gptme1$cj6$>...
> > ......
> > In A = sparse([1 2 1],[1 2 3],1), what the "1" represents after the two vector?
> > The similar question, in  B = sparse([1 2 1],[1 2 3],1,3,3), what the "1, 3, 3" represents repectivley?
>   Dhuan, you really should become accustomed to reading the documentation or help files for the functions you use.  You can't get very far in the use of Matlab without doing this.  (Confession: Sometimes I am guilty of the same failing.)
>   In the case of the 'sparse' function, its third argument determines what quantities are to be placed in the sparse matrix.  It is either a vector the same length as the first two arguments or a scalar which is to be repeated as many times as that length.  In the example I gave it is the scalar 1 repeated three times.
>   The additional 3,3 at the fourth and fifth arguments force the sparse matrix to have at least a size 3 in each dimension.  That is what is needed to produce a square 3 x 3 matrix even if the bottom row is all zeros.   Doing this kind of thing is what is necessary to present 'graphshortestpath' with a square matrix in your example even though your bottom two rows would be all zeros.
>   Earlier you asked "How can I change it to a square matrix without change the link connection information of my graph?"  The best way of course is to make appropriate use of the fourth and fifth arguments when you create the sparse matrix for the first time.  However, if you have already created a sparse matrix A and want to enlarge it without making any changes to its non-zero portions, you can always do this:
>  (I,J,S] = find(A);
>  B = sparse(I,J,S,m,n);
> which forces the creation of a copy of A which is at least a size of m x n even though some of its last rows or columns have may have no non-zero elements in them.
> Roger Stafford

Dear Mr.Roger
can i have ur private email??because i want to send my programmed..i have a problem in my matlab programme..i dont know how to solve it.. thank you