Thread Subject: vector to matrix

Subject: vector to matrix

From: zia

Date: 22 Jun, 2008 21:53:37

Message: 1 of 4

Hello all,
What is the quickest way in MATLAB to convert a 1 x N vector into a N
x N matrix with the values of the vector on the diagonal?

Thanks,
-Zia

Subject: vector to matrix

From: Marcus M. Edvall

Date: 22 Jun, 2008 21:59:50

Message: 2 of 4

help spdiags

Best wishes, Marcus
Tomlab Optimization Inc.
http://tomopt.com/
http://tomdyn.com/

Subject: vector to matrix

From: dpb

Date: 22 Jun, 2008 22:30:36

Message: 3 of 4

zia wrote:
> Hello all,
> What is the quickest way in MATLAB to convert a 1 x N vector into a N
> x N matrix with the values of the vector on the diagonal?

Oddly enough, diag(v) would seem to do that... :)

--

Subject: vector to matrix

From: zia

Date: 23 Jun, 2008 04:09:36

Message: 4 of 4

On Jun 22, 6:30=A0pm, dpb <n...@non.net> wrote:
> zia wrote:
> > Hello all,
> > What is the quickest way in MATLAB to convert a 1 x N vector into a N
> > x N matrix with the values of the vector on the diagonal?
>
> Oddly enough, diag(v) would seem to do that... :)
>
> --

Thanks. This worked.

-zia

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com