[vsni.co.uk] Contact us
Author Message
Post new topic

  GenStat  ~  Rearrange rows/columns of a matrix

Rodger White
Posted: Fri Apr 20, 2018 10:16 am Reply with quote
Guest
Carole,
You need to use a qualified identifier with a variable for the symmetric matrix in a calculate statement

Symmetric [row=4; val=*,2,*,0,1,*,3,0,0,*] sa
Variate [val=2,3,4,1] roword
Calc [pr=s] sb = sa$[roword]

Print sa
Print sb

Rodger



Rodger White
Statistics Group
Centre for Computational and Systems Biology
Rothamsted Research
West Common
Harpenden
Herts
AL5 2JQ
e-mail: rodger.white@rothamsted.ac.uk
[url=Tel:01582938378(direct]Tel: 01582938378(direct[/url] line)
[url=Tel:01582763133]Tel: 01582763133[/url] ext 2378


From: GENSTAT-Request [mailto:GENSTAT@jiscmail.ac.uk] On Behalf Of WRIGHT Carole
Sent: 20 April 2018 04:23
To: GENSTAT@JISCMAIL.AC.UK
Subject: Rearrange rows/columns of a matrix



Hello

Does anyone know how to rearrange the rows and columns of a symmetric matrix based on the row/column labels? For example, if I have the following matrix

4 *
1 2.0000 *
2 0.0000 1.0000 *
3 3.0000 0.0000 0.0000 *
4 1 2 3

can I rearrange it to be

1 *
2 1.0000 *
3 0.0000 0.0000 *
4 2.0000 0.0000 3.0000 *
1 2 3 4

Thanks
Carole

------------------------------
The information in this email together with any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. There is no waiver of any confidentiality/privilege by your inadvertent receipt of this material.
Any form of review, disclosure, modification, distribution and/or publication of this email message is prohibited, unless as a necessary part of Departmental business.
If you have received this message in error, you are asked to inform the sender as quickly as possible and delete this message and any copies of this message from your computer and/or your computer system network.
------------------------------


Rothamsted Research is a company limited by guarantee, registered in England at Harpenden, Hertfordshire, AL5 2JQ under the registration number 2393175 and a not for profit charity number 802038.

Post generated using Mail2Forum (http://www.mail2forum.com)

Display posts from previous:  

All times are GMT
Page 1 of 1
Post new topic

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum