Path: news.mathworks.com!not-for-mail
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$1@fred.mathworks.com>
References: <gprnm1$rid$1@fred.mathworks.com> <gprp12$1ta$1@fred.mathworks.com> <gprqjn$fki$1@fred.mathworks.com> <gptme1$cj6$1@fred.mathworks.com> <gptt1t$nvc$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1265145379 14222 172.30.248.37 (2 Feb 2010 21:16:19 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 2 Feb 2010 21:16:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2202990
Xref: news.mathworks.com comp.soft-sys.matlab:603828

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gptt1t$nvc$1@fred.mathworks.com>...
> "dhuan Du" <dupeony@gmail.com> wrote in message <gptme1$cj6$1@fred.mathworks.com>...
> > ......
> > 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